I’ve been working on a “don’t press the button” game for a while now and wanted to add dead messages today, but unfortunately the message only appears once in the chat.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:connect(function()
local Human = plr.Character:WaitForChild("Humanoid") --Defines a new human every time the player spawns.
Human.Died:connect(function()
MessagePlayer("all", plr.Name.." has died...",252, 0, 12,"SourceSansBold")
end)
end)
end)
You can have whatever’s in the PlayerAdded function to a new script in StarterCharacterScript and modify the names. This way, a new script will be created whenever your player respawns, as explained from HeyWhatsHisFace.
Of course, this is not optimized if you were to make for a lot of players.
For RBXScriptSignals :Wait() will only pause your script until it happens, then it will do everything after it.
On the other hand, :Connect() will run every time the event is fired, and in this case :Connect() should be used.
:Wait() can also be explained as a :Connect() function that instantly has :Disconnect() called on it after it was ran once.
Here’s the script that should fix it: