What do you want to achieve?
I would like this round script to repeat itself rather than doing what it does only once
What is the issue?
This script has a function in which it will make a gui pop up but it only happens once
What solutions have you tried so far?
I tried using repeat but that would display an error. I also tried while loops (while true do and while wait() do) But they would not do anything
Here is the script
local endGui = script.Parent.Parent.PlayerGui:WaitForChild("EndGui")
local gameInfo = endGui:WaitForChild("GameInfo")
local inRound = game.ReplicatedStorage.InRound
inRound.Changed:Connect(function()
if inRound.Value == false then
gameInfo.Visible = true
end
end)
There is no need to make a loop using while do or repeat until, you just need (as someone said) :GetPropertyChangedSignal("").
But at least from what I see your problem is in the function. You’re just setting Visible = true when Value == false once, but you’re not switching off back in any moment nor checking for it. If the value is controlled by the server and it is timed, there shouldn’t be any problem on directly setting the Visible property to the Value.
Yeah, but in that case it is obvious that your script won’t repeat. It’s like buying an apple, eating it and not buying another one, you can’t pretend to keep eating if you don’t buy another one.
You can’t set the value to true and just let it on true and pretend it will switch back to false for some magic reason. At some point, I don’t know at which one specifically (it depends on what you’re looking for) you’ll have to switch that thing off
You can use this line of code for a loop(or use RunService) and is more convenient because when the Value is true then it will show your gui and vise versa.
And write this:
local RS = game:GetService('RunService')
local ui_object
local inRound
RS.Stepped:Connect(function()
ui_object.Visible = inRound.Value
end)
Well, in this case (not pretending to be rude but…) it seems like a logic problem more than a coding one and I don’t really think there’s a concrete way for us to help you without getting some explicit info.
The thing is the following: if you want to switch on a gui when players are not in a round, the actual code is ok, if you want the gui to switch off when the player is in a round, add an extra:
else
gameInfo.Visible = false
These calls will automatically fire when the value changes and you won’t have to do nothing more other than switching the inRound value.
local RS = game:GetService('RunService')
local ui_object
local inRound
RS.Stepped:Connect(function()
if inRound.Value == false then
ui_object.Visible = true
else
ui_object.Visible = false
end
end)
I don’t know how to help if you say things that you did not state in you post.