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
6 years ago

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

local player = game.Players:WaitForChild("LocalPlayer") -- Wait for player join
local char = player:WaitForChild("Character") -- Wait for character add

char.HumanoidRootPart.CFrame = CFrame.new(100, 500, 136)
0
Btw it's a Localscript Cvbza 12 — 6y
0
Yea, you have to use a localscript for stuff like local player Lualaxy 78 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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

local players = game:GetService("Players")
local plr = players.LocalPlayer or players.PlayerAdded:Wait()
local char = plr.Character or plr.CharacterAdded:Wait() 

char.HumanoidRootPart.CFrame = CFrame.new(100,500,136)
Ad

Answer this question