Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is teleporting using :MoveTo() Unstable?

Asked by 3 years ago

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)
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. niroqeo 123 — 3y
0
I had this exact same problem, good luck with the answers cause I'm unsure if i have a working script yet. mrfrank79 30 — 3y
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 DemonsEmperor 26 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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!

Ad

Answer this question