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

Script using Player Added Isn't working on Studio?

Asked by 6 years ago

I made a script that uses PlayerAdded() but when I test it in studio it doesn't work but when I test it on the website it works perfectly. I looked at the output and nothing comes out. Am I doing something wrong?

wait(0.1)
local Radius = script.Parent
local CharacterPoint = nil

game.Players.PlayerAdded:connect(function(player)
    wait(5)
local Character = player.Character
CharacterPoint = Character:FindFirstChild("Head")

end)

PS: I'm using FE if that helps.

1 answer

Log in to vote
1
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

You should use CharacterAdded and WaitForChild:

local CharacterPoint
game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(Character)
        CharacterPoint = Character:WaitForChild("Head")
    end)
end)
Ad

Answer this question