CanTeleport = script.Parent.Value.Value CanTeleport = true script.Parent.Touched:connect(function(hit) if CanTeleport == true then CanTeleport = false if hit.Parent:FindFirstChild("Humanoid") ~= nil then hit.Parent.Head.CFrame = CFrame.new(114, -34.1, -368) CanTeleport = true wait(1) end end end)
The script above was not working, after the second time of using it. It worked the first time fine, but then after the second time it said "Head is not a Part of Accessory" or something like that.
After adding wait(0.2) to line 6 it worked, but what I just don't understand is why. Why do I need to allow the computer to wait for 0.2 seconds in order for it to function properly? As you probably know I'm new to scripting so please try to be.. simplistic with answering.