#I need a script FAST where it will say in the chat when a player has died
1 messages · Page 1 of 1 (latest)
idk
sds
I IMMEDIATELY don’t know how to help you.
make a remoteevent called SendChat in replicatedstorage
then put this code as a local script under startergui
local players = game:GetService("Players")
local plr = players.LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local sendChat = rp:WaitForChild("SendChat")
local tcs = game:GetService("TextChatService")
sendChat.OnClientEvent:Connect(function(msg, tag)
tcs.TextChannels.RBXGeneral:DisplaySystemMessage("[".. tag .."]".. msg)
end)
Now, put this script under serverscriptservice
local players = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")
local sendChat = rp:WaitForChild("SendChat")
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
hum.Died:Connect(function()
sendChat:FireAllClients(" ".. plr.Name .. " has died!", "Server")
end)
end)
end)
there u go @west mirage , finished!
TYSM
ALSO
DO YKU KNOW HOW TO KAKE A SCRIPT WHERE
WHEN A SCREEN GUI BUTTON IS PRESSED, IT COPIES A TOOL CALLED PUSH FROM REPLICATED STORAGE AND SENDS IT TO EVERY PLAYER IN THR GAME?
ok so
put this as a local script under the button u want to press to givre the tools
local button = script.Parent
local rp = game:GetService("ReplicatedStorage")
local giveTool = rp:WaitForChild("GiveTool")
button.Activated:Connect(function(input, clickCount)
giveTool:FireServer()
end)
--oh and make a remote event named GiveTool
and put ur tool in replicated storage
and put this as a script under server script service
local players = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")
local tool = rp:WaitForChild("Tool") -- change this to the name of your tool
local giveTool = rp:WaitForChild("GiveTool")
giveTool.OnServerEvent:Connect(function(plr)
local clone = tool:Clone()
for _, player in players:GetPlayers() do
local backpack = player:FindFirstChild("Backpack")
if backpack then
local tool = backpack:FindFirstChild("Tool")
if not tool then
clone.Parent = backpack
end
end
end
end)
there u go @west mirage !
I LOVE YOU
yw!
dont forget to modify the rp:WaitForChild("Tool") to the name of ur tool
for exampl
i change rp:WaitForChild("Tool") to rp:WaitForChild("Sword") if the name of tool i had was called 'Sword'
is it working @west mirage ?
** You are now Level 6! **
Why not
Player.Added:Connect(function(plr)
plr.Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
-- TODO send in chat
end)
end)
On a server script
that says if their health has changed, not if they had died completely
plus u can use plr.Character.Humanoid.HealthChanged instead
It was an example for the question if its better to do it on a server script and dont use any remotes
u need one if a player dies
fir
a server message
how else will we access the players gui?
Through the .PlayerAdded Event on the server script