Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is teleporting using :MoveTo() Unstable?

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

0

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.

0

I had this exact same problem, good luck with the answers cause I'm unsure if i have a working script yet.

0

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

1 answer

I changed the game to allow only R15 characters and started CFrame moving the HumanoidRootPart. For anyone who finds similar issues, this so far has not failed me!

This discussion is preserved as it was. New answers, comments, and votes are closed.