Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to make the teleport not loop?

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

✓ Accepted answer

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

1 comment

0

this code didnt work but the if teleport thing you used is what worked when i added it to my script

This discussion is preserved as it was. New answers, comments, and votes are closed.