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

Object doesn't spin after 5 seconds?

So I have this code for a Round Timer, which teleports you to another Map after some seconds.

-- Round variables
local roundLength = 60
local intermissionLength = 15
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.Lobby.LobbySpawn
local GameAreaSpawn = game.Workspace.Map1.GameAreaSpawn1
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 = GameAreaSpawn.CFrame
        end
    else
        for _, player in pairs(game.Players:GetChildren()) do
            local char = player.Character
            char.HumanoidRootPart.CFrame = LobbySpawn.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)

This works fine. On my other Map I have a spinning object which should start spinning 5sec after the value of InRound = true. I have this code for it:

local InRound = game.ReplicatedStorage.InRound

if InRound.Value == true then
	wait(5)
	script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(.0,.05,.0) 
	wait() 
end

But it kinda doesnt spin. I hope you can help! Thanks

1 answer

I don't know the code for this but the issue, I think, is that the other script when ran, checks for the InRound, which is falsey. But when the InRound value is truety, the code has already ran.

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