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

How do I reference a players Humanoid when they join the game?

Asked by 3 years ago

I need to find out how to reference a players humanoid without them touching a part. For example, when they join the game their WalkSpeed in their Humanoid is set to 30. Anyone know a script that can help me with this?

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

Try this:

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local Humanoid = Character:FindFirstChild("Humanoid")
    end)
end)

It's better you put scripts like this in StarterCharacterScripts so you can simply do Humanoid = script.Parent:FindFirstChild("Humanoid"). But that depends on usage case.

0
wouldn't "Character:WaitForChild("Humanoid",10)" work better? 0hsa 193 — 3y
0
0hsa, basically no. There wouldn't be a reason to wait for humanoid every 10 seconds because humanoid is spawned in the character first. Lakodex 711 — 3y
0
They'll both point to humanoid, but there's no point in waiting since the character spawns in with the humanoid. radiant_Light203 1166 — 3y
0
hey dude radiant_Light could u pls help me with a script ... plssss i really need ur help , dm me on discord xbloodyguyx#2156 xbloodyguyx 10 — 3y
0
Ask a question on this site. I'll answer if I can. radiant_Light203 1166 — 3y
Ad

Answer this question