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

Help can't get character players ??

Asked by
Cvbza 12
7 years ago

I'm trying to get the player's character.

1local player = game.Players:WaitForChild("LocalPlayer") -- Wait for player join
2local char = player:WaitForChild("Character") -- Wait for character add
3 
4char.HumanoidRootPart.CFrame = CFrame.new(100, 500, 136)
0
Btw it's a Localscript Cvbza 12 — 7y
0
Yea, you have to use a localscript for stuff like local player Lualaxy 78 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Can't get the LocalPlayer like that. The character either. Two ways to get the character , first get the player

1local players = game:GetService("Players")
2local plr = players.LocalPlayer or players.PlayerAdded:Wait()
3local char = plr.Character or plr.CharacterAdded:Wait()
4 
5char.HumanoidRootPart.CFrame = CFrame.new(100,500,136)
Ad

Answer this question