Hey Guys! So i wrote this and it runs perfectly, then suddenly on occasion it will run once and break giving saving it cant perform a moveto on nil..? Then on other occasions it will give that without even running once first. I make no altercations when it does this. its simply for whatever reason non-reliable. Can someone tell me why? or give me an alternative? I had used CFrame before but it was also shaky so I started using MoveTo.
ting = 0
function ontouch(Hit)
if ting == 0 then
ting = 1
local char = game.Workspace:FindFirstChild(Hit.Parent.Name)
char:MoveTo(game.Workspace.PortalHub.Spawn.Position)
wait(0.5)
ting = 0
end
end
script.Parent.Touched:Connect(ontouch)

3 comments
That means that the thing you're moving the character to something doesn't exist. Re-check your scripts and see if anything removes the spawn. If it does, there's your smoking gun.
I had this exact same problem, good luck with the answers cause I'm unsure if i have a working script yet.
I in order to avoid issues have never changed where the spawn is located in the game/folders/models. and the spawn is never moving/changing/doing anything.Its simply inconsistent