Hello everyone! I have a script which changes a player value's value (a player value) and a local script which detects when the value has been changed. If it was, it will make a UI visible.
local player = game.Players.LocalPlayer local CODR = player:WaitForChild("CODR") -- a boolean value CODR.Changed:Connect(function(val) script.Parent.Visible = true end)
But the UI was not turning visible. I decided to add a print statement in front of the line telling the UI to turn it visible saying "script.Parent.Visible". the Output printed 'true'
local player = game.Players.LocalPlayer local CODR = player:WaitForChild("CODR") -- a boolean value CODR.Changed:Connect(function(val) script.Parent.Visible = true print(script.Parent.Visible) -- output printing true end)
Output = true but the UI is not turning visible By the way, the script thats changing the value is located in a model in the workspace
Hello there.
If its a Boolean value, there's really no need to use
CODR.Changed
Instead, you could use a while loop
while true do wait(0.00001) if CODR.Value == true -- or false then script.Parent.Visible == true end end)
I hope this answers your question
P.S. if you change the value to false then do this in the script
while true do wait(0.00001) if CODR.Value == false -- or true then script.Parent.Visible == false end end)
Hello everyone, I have solved the problem myself! Apparently I had to make the UI visible on the script
instead of in the local script but I have no clue why