Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How do i make a message when a player dies???

Asked by 9 years ago

im still a new sceripter so i need some help, the scripting forum just makes fun of me so i come here.

i want a hint message to pop up for 5 seconds when a player dies.

1 answer

Log in to vote
2
Answered by 9 years ago

Hello, I see you are asking about the .Died function.

Here is an example of what you are looking for:

IN A SERVER SCRIPT

01game.Players.PlayerAdded:connect(function(plr)
02    plr.CharacterAdded:connect(function(char)
03        repeat wait() until char.Humanoid
04        local humanoid = char.Humanoid
05 
06        local function died()
07            local hint = Instance.new("Hint")
08            hint.Parent = game.Workspace
09            hint.Text = plr.Name.." has died!"
10            wait(5)
11            hint:destroy()
12        end
13 
14        humanoid.Died:connect(died)
15    end)
16end)

Here is what we used:

http://wiki.roblox.com/index.php?title=API:Class/Player/CharacterAdded http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Died

Local functions are basically functions inside functions, which is what the died function is.

0
thank you again gulliblechap, i think i can learn some more lua on my own, im working on learning if statements! freezysniper 0 — 9y
0
once again freezy, its no problem GullibleChapV2 155 — 9y
Ad

Answer this question