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

Can someone help me with teleporting? [UNANSWERED]

Asked by 10 years ago

No output was given. My suggestion is that when it Moves them, it may error. But, it's not working and I can't figure out why.

plr = game.Players.LocalPlayer
z = plr.Up.Value
RandomName = {"SpawnLocation1","SpawnLocation2","SpawnLocation3","SpawnLocation4","SpawnLocation5","SpawnLocation6","SpawnLocation7","SpawnLocation8","SpawnLocation9"}
abcd = {"SpawnLocationU1","SpawnLocationU2","SpawnLocationU3","SpawnLocationU4"}

function Down()
    for i,v in pairs(game.Workspace:GetChildren()) do
    for a,b in pairs(RandomName) do
            if v.Name == b then
    TheRandomizer = RandomName[math.random(#RandomName)]
                plr.Character.Humanoid:MoveTo(game.Workspace[TheRandomizer].Position)
                z = false
            end
        end
    end
end

function Up()
    for i,v in pairs(game.Workspace.Lobby:GetChildren()) do
        for i,v in pairs(game.Workspace:GetChildren()) do
    for a,b in pairs(abcd) do
            if v.Name == b then
    LeRandomizer = abcd[math.random(#abcd)]
                plr.Character.Humanoid:MoveTo(game.Workspace[LeRandomizer].Position)
                z = true
end
end
        end
    end
end

script.Parent.MouseButton1Down:connect(function()
    if z == true then
        Down()
    elseif z == false then
        Up()
    end
end)
0
I can't see anything wrong. Are you sure it's a LocalScript placed right? Tesouro 407 — 10y
0
It's in a GUI in the StarterGui. Pawsability 65 — 10y

Answer this question