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

How to Detect and Fire Function on EVERY Character Reload?

Asked by
Moxeh 84
6 years ago
Edited 6 years ago

How do I detect every time a character reloads, not just on game entry? I need to fire a function to reload a stored value every time the character respawns. All of this needs to happen locally, this is reloading a MouseIcon that the player has chosen. Thanks in advance!

0
You can put the value inside of a ScreenGui in the StarterGui and turn ResetOnSpawn on the ScreenGui property on. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
6 years ago

First let's make the player added event

game.Players.PlayerAdded:connect(function(plr)

end)

Then lets add the characteradded event

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)

    end)
end)

Now we have an event that fires when ever that player's character respawns

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        print(char:WaitForChild("Humanoid").WalkSpeed)
    end)
end)
Ad

Answer this question