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 8 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 8 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

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        repeat wait() until char.Humanoid
        local humanoid = char.Humanoid

        local function died()
            local hint = Instance.new("Hint")
            hint.Parent = game.Workspace
            hint.Text = plr.Name.." has died!"
            wait(5)
            hint:destroy()
        end

        humanoid.Died:connect(died)
    end)
end)

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 — 8y
0
once again freezy, its no problem GullibleChapV2 155 — 8y
Ad

Answer this question