Prints out 'Infinite yield possible on 'Players.10x31x2019:WaitForChild("Character")' did i type anything wrong? I changed it back in forth from "FindFirstChild" to "WaitForChild" Any Solutions?
local player = game.Players.LocalPlayer local character = player:WaitForChild("Character") local HumanoidRootPart = character:WaitFirstChild("HumanoidRootPart") wait(3) HumanoidRootPart.CFrame = CFrame.new(part.Position)
You cannot do WaitForChild
on a Character, the reason for this is because the Character just redirects you to the workspace, the WaitForChild
is waiting for a descendant named Character to enter it before running the script, i recommend you just do this:
re-written script for you (since yours is causing problems)
game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) local stoperror = Character:WaitForChild("HumanoidRootPart") wait(3) Character.HumanoidRootPart.CFrame = workspace.Part.CFrame * CFrame.new(0, 0.5, 0) Character:Disconnect() end) end)
updated the script and theres still another problem 'Players.10x31x2019.PlayerScripts.LocalScript:3: attempt to index nil with 'WaitForChild'
part = workspace.Part local player = game.Players.LocalPlayer local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart") wait(5) HumanoidRootPart.CFrame = CFrame.new(part.Position)
local character = player.Character or player.CharacterAdded:Wait()
this?