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

Is there a way to make the teleport not loop?

Asked by 3 years ago

this script controls the rounds but its in a while true do loop, so when it is time to teleport to the map, it infinitely teleports you to the same point, is there a way to make the teleport not be infinite?

local replicatedstorage = game:GetService("ReplicatedStorage")
local status = replicatedstorage:WaitForChild("StatusValue")
local GridMap = game.ServerStorage.LaserGridLevel
local Grass = game.ServerStorage.Grass
local inorout = 1


while true do
-- Intermission
for i = 30,1,-1 do
        status.Value = "Intermission: "..i 
        GridMap.Parent = game.ServerStorage
wait(1)
end
    status.Value = "Game in progress"
    for i = 60,1,-1 do
        status.Value = "Game in progress: "..i 
        GridMap.Parent = game.Workspace
        for _, plr in pairs(game.Players:GetChildren())do
            plr.Character.HumanoidRootPart.CFrame = CFrame.new(55, 22.9, -710.75)
        end
        wait(1)
        status.Value = "Game Over!"

    end 
end

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

Not sure if this will work, but it should:

local replicatedstorage = game:GetService("ReplicatedStorage")
local status = replicatedstorage:WaitForChild("StatusValue")
local GridMap = game.ServerStorage.LaserGridLevel
local Grass = game.ServerStorage.Grass
local inorout = 1
local teleported = false


while true do
-- Intermission
for i = 30,1,-1 do
        status.Value = "Intermission: "..i 
        GridMap.Parent = game.ServerStorage
wait(1)
end
    status.Value = "Game in progress"
    for i = 60,1,-1 do
        status.Value = "Game in progress: "..i 
        GridMap.Parent = game.Workspace
        for _, plr in pairs(game.Players:GetChildren())do
        if teleported == false do
                plr.Character.HumanoidRootPart.CFrame = CFrame.new(55, 22.9, -710.75)
            teleported = true
        end
        end
        wait(1)
        status.Value = "Game Over!"
    teleported = false
    end 
end
0
this code didnt work but the if teleport thing you used is what worked when i added it to my script surviarlTheJefkillre 55 — 3y
Ad

Answer this question