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

How to teleport to different places?

Asked by 8 years ago

I have a teleport script but instead of teleporting players to their individual spaces it teleports everybody to the same place, the area where the first player teleports no matter where it is, here is the script:

    if game.Workspace.VeryEasy.VeryEasy.A.Value == "" or game.Workspace.VeryEasy.VeryEasy.A.Value == script.Parent.Parent.Parent.Parent.Name then
        game.Workspace.VeryEasy.VeryEasy.A.Value = script.Parent.Parent.Parent.Parent.Name
        script.Parent.Parent.Visible = false
        TeleportSlot1()
        game.Workspace.VeryEasy.VeryEasyA["1"].Position = Vector3.new(18662,math.random(7.5,10.5),math.random(2219, 2227))
        game.Workspace.VeryEasy.VeryEasyA["2"].Position = Vector3.new(18682,math.random(7.5,10.5),math.random(2219, 2227))
        game.Workspace.VeryEasy.VeryEasyA["3"].Position = Vector3.new(18702,math.random(7.5,10.5),math.random(2219, 2227))
        game.Workspace.VeryEasy.VeryEasyA["4"].Position = Vector3.new(18722,math.random(7.5,10.5),math.random(2219, 2227))
        game.Workspace.VeryEasy.VeryEasyA.Time.Value = 120
        wait(120)
        game.Workspace.VeryEasy.VeryEasyA["1"]:RemoveAllChildren()
        game.Workspace.VeryEasy.VeryEasyA["2"]:RemoveAllChildren()
        game.Workspace.VeryEasy.VeryEasyA["3"]:RemoveAllChildren()
        game.Workspace.VeryEasy.VeryEasyA["4"]:RemoveAllChildren()
        CanActivate = true
    elseif game.Workspace.VeryEasy.VeryEasy.B.Value == "" or game.Workspace.VeryEasy.VeryEasy.B.Value == script.Parent.Parent.Parent.Parent.Name then
        game.Workspace.VeryEasy.VeryEasy.B.Value = script.Parent.Parent.Parent.Parent.Name
        TeleportSlot2()
        game.Workspace.VeryEasy.VeryEasyB["1"].Position = Vector3.new(18662,math.random(7.5,10.5),math.random(2230, 2238))
        game.Workspace.VeryEasy.VeryEasyB["2"].Position = Vector3.new(18682,math.random(7.5,10.5),math.random(2230, 2238))
        game.Workspace.VeryEasy.VeryEasyB["3"].Position = Vector3.new(18702,math.random(7.5,10.5),math.random(2230, 2238))
        game.Workspace.VeryEasy.VeryEasyB["4"].Position = Vector3.new(18722,math.random(7.5,10.5),math.random(2230, 2238))
        game.Workspace.VeryEasy.VeryEasyB.Time.Value = 120
        wait(120)
        game.Workspace.VeryEasy.VeryEasyB["1"]:RemoveAllChildren()
        game.Workspace.VeryEasy.VeryEasyB["2"]:RemoveAllChildren()
        game.Workspace.VeryEasy.VeryEasyB["3"]:RemoveAllChildren()
        game.Workspace.VeryEasy.VeryEasyB["4"]:RemoveAllChildren()
        CanActivate = true

...

function TeleportSlot1() game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name].Torso.CFrame = CFrame.new(18641, 13, 2223) end function TeleportSlot2() game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name].Torso.CFrame = CFrame.new(18641, 13, 2234) end function TeleportSlot3() game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name].Torso.CFrame = CFrame.new(18641, 13, 2245) end function TeleportSlot4() game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name].Torso.CFrame = CFrame.new(18641, 13, 2256) end function TeleportSlot5() game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name].Torso.CFrame = CFrame.new(18641, 13, 2267) end

0
This is only the 2 parts of script that has to do with teleporting. DivineObliteration 9 — 8y
0
Try caching the individual spaces in a global table,then iterating through that table and the playerlist to teleport the players to those positions. Reshiram110 147 — 8y
0
Well what this script basically does is once you click a gui it checks if there is a player in the first slot, if not it teleports you, if so it checks second slot and so on. So if you are talking about something like for i, v, in pairs do then I don't think that would work, though I'll try before making false assumptions, thanks. DivineObliteration 9 — 8y
0
Sorry I am a loser at scripting and can't figure out how to implement global functions to a script like this. any other ideas? By the way I am trying to make a rifle range, hoping to help my horrible aim lol. Aside from this and one other random problem everything works :D DivineObliteration 9 — 8y
0
the method is ClearAllChildren and not RemoveAllChildren 1waffle1 2908 — 8y

Answer this question