I have this script that is supposed to make the player's gui visible if playing is equal to false and make it not visible if playing is equal to true but for some reason the script constantly outputs saying "playing = false" even when I make the playing value equal true? The playing value is a boolean value in a folder in the workspace
while wait() do if game.Workspace.Values.Playing.Value == false then print("playing = false") script.Parent.Visible = true else if game.Workspace.Values.Playing.Value == true then print("playing = true") script.Parent.Visible = false end end end
Here's my code, a good explanation in the notes as well.
--[[ It is suggested that you use "workspace" instead of "game.Workspace". ]] while wait() do --[[ It's good to use pcall (protect-call) so that you don't run into an error. ]] pcall(function() script.Parent.Visible = not workspace.Values.Playing.Value --[[ Using not in this situation is a better method, meaning it'll be the opposite of the actual value. So if it was true, it'd set the visibility to false here. ]] end) end