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

ummm my script keeps teleporting me constantly each time only when it is intermission?

Asked by 4 years ago

Please help me I cant figure it out.

local roundLength = 120
local intermissionLength = 15
local Status = game.ReplicatedStorage.Status
local inRound = game.ReplicatedStorage.InRound
local Lobby = game.Workspace.Lobby
local Roundspawn = game.Workspace.Maps["Science Lab"].ScienceLabsSpawns.ScienceLabSpawn


inRound.Changed:Connect(function()
    wait(1)
    if inRound.Value == true then
        for _, player in pairs(game.Players:GetChildren()) do
            local char  = player.Character
            char.HumanoidRootPart.CFrame = Roundspawn.CFrame
        end 

    else
        wait(1)
        for _, player in pairs(game.Players:GetChildren()) do
            local char  = player.Character
            char.HumanoidRootPart.CFrame = Lobby.CFrame
        end

    end

end)




local function roundTimer()
    while wait() do
        for i = intermissionLength, 1, -1 do
            inRound.Value = false
            wait(1)
            Status.Value = "intermission: ".. i .." seconds left!"
        end
        for i = roundLength, 1, -1 do
            inRound.Value = true
            wait(1)
            Status.Value = "Game: ".. i .." seconds left"
        end
    end 
end

spawn(roundTimer)



0
Use GetPropertyChangedSignal() instead of Changed. Changed event checks for ANY changes. Dovydas1118 1495 — 4y

1 answer

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

You see, the "inRound" value is never false, which is why it keeps on constantly teleporting you.

Fix it by adding

inRound.Value == false

under if inRound.Value == true then

then when your round ends, add

inRound.Value == true

to where the round ends to restart the loop

Ad

Answer this question