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

What have I done wrong with these 4 lines of code? The lines after the first aren't working

EDIT:

local InRound = game.ReplicatedStorage.InRound
local Timer = game.ReplicatedStorage.Timer
local IntermissionScreen = game.StarterGui.Intermission.Frame
local Maps = game.StarterGui.Intermission.Frame.MapBox.Maps
local Menu = game.StarterGui.Menu.Frame

InRound.Value = false
Timer.Value = 20 -- intermission time
while InRound.Value == false do
	repeat
		Maps.Visible = false
		wait(1)
		Timer.Value -= 1
	until Timer.Value == 30
	Maps.Visible = true
	repeat
		wait(1)
		Timer.Value -= 1
	until Timer.Value == 0
	IntermissionScreen.Visible = false -- this line and below are the one's not working
	Menu.Visible = false
	InRound.Value = true
	-- script the code that will teleport only the players on the intermission screen
end

And yes I'm pretty positive it's not a spelling error or anything like that

3 comments

0

DId you add in a repeat statement in the first line?

0

Is that your whole script?

0

Yes there's a repeat statement above, and no that's not my whole script. I'll edit it into the post

1 answer

On line 8 you set the timer value to 20. So in the first repeat until loop, when you subtract one from the timer, it will never reach 30, as it is already below 30 and going down further.

4 comments

1

I'm just realizing that and I fixed the issue, but that doesn't seem to be the main problem. The GUI elements still don't seem to be appearing and disappearing when they're supposed to

0

I think it is because you are changing the gui from the startergui. This will not change the client's gui, which is located in PlayerGui under each individual player. I recommend creating remote events that fire to each client, and have a local script that changes the gui whenever those events are fired.

0

Sorry to be such a bother, I'm fairly new to scripting. I've been searching all over but can't really find an answer, how do I fire remote events?

0

On the server side, remoteEvent:FireAllClients(arg1, arg2..., arg4) where there can be multiple arguments or none. On the client side, get the remote event and then do remoteEvent.OnClientEvent:Connect(function(arg1, arg2...arg4). Here's a better explanation on the developer API website: https://developer.roblox.com/en-us/api-reference/event/RemoteEvent/OnClientEvent

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