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

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

Asked by 4 years ago
Edited 4 years ago

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

0
DId you add in a repeat statement in the first line? FrontsoldierYT 129 — 4y
0
Is that your whole script? RazzyPlayz 497 — 4y
0
Yes there's a repeat statement above, and no that's not my whole script. I'll edit it into the post PatrickLovesJesus 15 — 4y

1 answer

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

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.

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 PatrickLovesJesus 15 — 4y
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. RedReedBird 205 — 4y
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? PatrickLovesJesus 15 — 4y
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 RedReedBird 205 — 4y
Ad

Answer this question