So I have a script made that when the value of the NumberValue is greater than 1, it is supposed to make the visible trait of the frame false. Anyone know how to fix this?
local Slide = script.Parent.Parent.Parent.Number local Container = script.Parent.Parent while true do if Slide.Value > 1 then Container.Visible = false end end
So there is a TextButton that, when clicked, changes the number value to 2 of the NumberValue. Here is the script I used to do that in case that helps. After this script triggers it will trigger my other script (The one that is posted above) that I put inside a TextBox which displays the title of my game.
local Slide = script.Parent.Parent.Parent.Number function onClick() if Slide.Value < 2 then Slide.Value = Slide.Value + 1 end end script.Parent.MouseButton1Click:connect(onClick)
The hierarchy of this stuff is the following: StarterGui, ScreenGui, Frame (Renamed Holder), then a NumberValue (Renamed Number) and a Frame (Renamed Container), then inside of Container is a TextButton (Renamed Next) and a TextBox. There is a script inside the TextButton and the TextBox. The script in the TextButton is the second script posted above. The one that is not working is inside the TextBox.
You really shouldn't be using a while true do
loop for making a GUI's visible become false. Instead of having a script add a number into a value and then continously check if it's the correct condition to continue your script, you just should have a button you'll press to make it be "Invisible".
I don't see anywhere in your script where it will be possible to make it visible again, so I will not be using a NumberValue or any of those because all you're doing is making it "Invisible".
GUI's should use LocalScripts! This script should be in a LocalScript, if it's in a script it will NOT work. This localscript is going to make the GUI invisible: (Put into TextButton)
script.Parent.MouseButton1Click:connect(function() -- This is how I do my functions... game.Players.LocalPlayer.PlayerGui.ScreenGui.Holder.Number.Container.Visible = false end)
Now you no longer need the other script.
Comment questions/problems!