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

Why does my teleport script work in studio when testing, but not in actual servers?

Asked by
AronYstad 101
3 years ago

I have this teleport script that runs every 60 seconds, but for some odd reason, it doesn't teleport anyone in an actual server, even though it does work while testing in studio.

function tp()
    local teleport = Vector3.new(0,2,0)
    local players = game.Players:GetChildren()
    for i = 1, #players do
        local player = players[i]
        local humanoidrootpart = player.Character:FindFirstChild("HumanoidRootPart")
        humanoidrootpart.CFrame = CFrame.new(teleport)
        teleport = teleport + Vector3.new(0,5.5,0)
    end
end

It worked fine before I added

teleport = teleport + Vector3.new(0,5.5,0)

and moved

local teleport = Vector3.new(0,2,0)

into the function (it was outside before) but I don't understand how that would ruin the script.

0
It turns out that it was moving local teleport = Vector3.new(0,2,0) into the function that caused the problem, but I don't understand why. Can someone explain? AronYstad 101 — 3y
0
And I still don't have a solution to the problem, since I need to reset the teleport variable after every teleport. AronYstad 101 — 3y
0
Is this in a LocalScript or Script? andarwniceguyjr 0 — 3y
0
Script. AronYstad 101 — 3y

Answer this question