local rep = game:GetService(“ReplicatedStorage”) local playingCount = rep:WaitForChild(“playingCount”) local Status = rep:WaitForChild(“Status”) while true do Status.Value = “waiting...” repeat wait(1) until playingCount.Value > 0 Status.Value = “starting...” end
playingCount is an intValue in replicatedstorage. I have it so that the click of a GUI button will increase playingCount by 1. I checked the value manually, it does increase. but the “repeat wait(1) until ...” never stops waiting(1).
to test it out, i did this:
repeat print(playingCount.Value) wait(1) until playingCount.Value > 0
and despite the value actually being 1, the script variable remains 0
how fix? need 2 fix. am not know how fix. thx
If this is in a Server Script, you will need to use Remote Events. Changes made by the client aren't replicated to the server, therefore if you change it in the explorer or have a local script change the value, the Server won't know. You can add a remote event in Replicated Storage. When you click a button, the remote event will :FireServer()
, then have a Server Script wait for the event to fire, then do the actions.Also I do not recommend putting a repeat until
inside of while true do
. The while true do
is useless here becuase I'm assumming this code will only run until the value is bigger than 0.