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

Teleporting script not teleporting?

Asked by 8 years ago

The script it supposed to teleport people to random points on the place. However, the script will not do this, and output gave me nothing.

Can someone please help me?

Here's the script:

local Playing = game.ServerScriptService.MainGameScript.Variables:WaitForChild("Playing")
local Player = game.Players.LocalPlayer
local TeleVal = Player:WaitForChild("Teleported")

while wait(0.01) do
    if Playing.Value == true and TeleVal.Value == false then
        TeleVal.Value = true
        BB = {} 
        DD = {}
        GG = {}
        RR = {}
        for i,v in ipairs(game.Workspace.Map.Spawns.BBS:GetChildren()) do
        if v.Name == "Spawn" then
                table.insert(BB,v)
            end
        end
        for i,v in ipairs(game.Workspace.Map.Spawns.DDS:GetChildren()) do
            if v.Name == "Spawn" then
                table.insert(DD,v)
            end
        end
        for i,v in ipairs(game.Workspace.Map.Spawns.GGS:GetChildren()) do
            if v.Name == "Spawn" then
                table.insert(GG,v)
            end
        end
        for i,v in ipairs(game.Workspace.Map.Spawns.RRS:GetChildren()) do
            if v.Name == "Spawn" then
                table.insert(RR,v)
            end
        end
        if Player.TeamColor == BrickColor.new("Bright red") then
            Player.Character:MoveTo(RR[math.random(1,#RR)].CFrame)
        elseif Player.TeamColor == BrickColor.new("Bright blue") then
            Player.Character:MoveTo(BB[math.random(1,#BB)].CFrame)  
        elseif Player.TeamColor == BrickColor.new("Bright yellow") then
            Player.Character:MoveTo(DD[math.random(1,#DD)].CFrame)
        elseif Player.TeamColor == BrickColor.new("Bright green") then
            Player.Character:MoveTo(GG[math.random(1,#GG)].CFrame)  
        end
        if Player.Lethals ~= nil then
            local children = Player.Lethals:GetChildren()
            for i = 1, #children do
                children[i].Value = 2
            end
        end
    end
end

Answer this question