I am trying to make a script that runs on While True Do, And doesnt Fail but the Failing part is bad...
Here is the script.
game.Players.PlayerAdded:connect(function(plr) print("I Didnt Break") while true do print("I Didnt Break") plr.Character.Head.Mesh.MeshId = "http://www.roblox.com/asset/?id=19999257" print("I Didnt Break") plr.Character.Head.Mesh.TextureId = "http://www.roblox.com/asset/?id=20001023" print("I Didnt Break") plr.Character.Head.Transparency = "0.25" print("I Didnt Break") end end)
The Plr.Character, Via Character is said to be a nil value...
The correct way of using a player's character is through the CharacterAdded event in the player. In your specific case, you'll also want to make sure the head also exists in the player before messing with it. To do that, you'll need the :WaitForChild() function to safely get the head and use it.
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) local head = char:WaitForChild('Head') -- do stuff with the head end) end)
Locked by adark and evaera
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?