Having a problem with my code, trying to script a gui to show up when the value = true. I have two scripts, one is a local script under a screen GUI in starter gui, and the second script is a local script, here is an image of everything:
local MenuOver = script.Parent:FindFirstChild("MenuOver") MenuOver.Value = false print(MenuOver.Value)
First of all, the value of menu over prints properly like its supposed to.
After this part is some other code for the menu, but that isnt important.
Here is the second part of the script
MenuOver.Value = true print(MenuOver.Value) SlideOutSidebar:Play()
It also prints properly here as well.
Now here is the second script:
local Tween = game:GetService("TweenService") local MenuOver = script.Parent:FindFirstChild("MenuOver") local StatusText = script.Parent.Status.TopBar.Status local StatusBar = script.Parent.Status.TopBar print(MenuOver.Value) -- This prints successfully local SlideInSidebar = Tween:Create(StatusBar,TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0, false, 0),{Position = UDim2.new(0.2,0,0,0)}) if MenuOver.Value == true then SlideInSidebar:Play() print(MenuOver.Value) end StatusText.Text = workspace.Game.GameRun.Status.Value
Not sure why, but it doesnt do anything inside of the if true then part, why is that?
Is it inside of a function or is it just plain outside? If it's not in a function then the problem is that it runs once and if MenuOver is not true it won't do anything. I recommend that you use a MenuOver.Changed:Connect() and nest the if condition inside of it.
Something like:
MenuOver.Changed:Connect(function() -- put your if condition here. end)