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

How to properly subtract...?

By this time, I've done everything that I could think of. For a game that I'm developing, I'm making a timer script for the Intermission. I remembered that somebody could join in-between, and they wouldn't see the GUI, so I tried to make it happen. In the GUI, it has a while loop that makes the text the value of the IntValue. This works perfectly fine in 'Play Solo', just not in a server. Any tips?

while true do
	wait()
	if game.Workspace.Timers.Value == true then -- I have a script that does this and it works fine.
		game.Workspace.Timers.Value = false
		for i=1,30 do
		game.Workspace.Time.Value = game.Workspace.Time.Value - 1
		wait(1)
		end
		for i,v in pairs(game.Players:GetChildren()) do
			v.PlayerGui.Intermission:Destroy()
		end
		game.StarterGui.Intermission:Destroy()
	end
	wait()
end

1 answer

I tested it and changed :GetChildren() to :GetPlayers() which may be the case. As well as changing the variable you put for players to _ in-case it was a variable problem. Nothing else seemed to be broken after that.

while true do
    wait()
    if game.Workspace.Timers.Value == true then
        game.Workspace.Timers.Value = false
        for i=1,30 do
        game.Workspace.Time.Value = game.Workspace.Time.Value - 1
        wait(1)
        end
        for _,v in pairs(game.Players:GetPlayers()) do
            v.PlayerGui.Intermission:Destroy()
        end
        game.StarterGui.Intermission:Destroy()
    end
    wait()
end

1 comment

0

It wasn't the case, but this did lead me to thinking how to resolve the problem. It wasn't much in this script, but another script. +1 for taking your time away.

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