Ad
Log in to vote
0

The .Visible Property isn't updating, Is this a bug?

Asked by 2 months ago

Hello, In my script I have it set to when ever you press a button it makes certain things visible and others invisible, the problem is it changed the property in the property tab but not on screen. I can got to the objects visible property and it will be off and it will still be on screen. When I turn it off before I start the game it disappears but not when I use a script. Keep in mind I am new, so I'm sorry if this is a dumb question. Another thing to note is that it was working until I changed the order of the uis in the starter UI and before I made some coding edits.

--Variables:

local everything =  game.StarterGui:WaitForChild("ScreenGui"):WaitForChild("Frame")
local ShopFrame = game:GetService("StarterGui").ScreenGui.ShopFrame
local shopui = game:GetService("StarterGui").ScreenGui.Frame.ShopGUI 
local buttonframe = game:GetService("StarterGui").ScreenGui.Frame.ShopButton.Frame
local Start = script.Parent.Parent.Start


button.MouseButton1Down:Connect(function()
    print("Help")
    everything.Visible = false
    if everything.Visible == false then
        print("yes")
        shopui.Visible = true
        shopui:TweenPosition(UDim2.new(0.351, 0, 0.15, 0), "Out", "Quad", 0.2, true)
        ShopFrame.Visible = true
    else
        return nil
    end

end)

Thanks!!

0
It prints Help and Yes just fine btw EmeraldRailYT 8 — 2mo
0
Any errors? Soban06 314 — 2mo
0
Nope EmeraldRailYT 8 — 2mo

1 answer

Log in to vote
0
Answered by 2 months ago

I think that it doesn't work as it relates to StarterGui and not the player's gui. You should try and change the lines from 3 to 6. If your script is LocalScript, then it would look like this:

local everything =  game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:WaitForChild("Frame")
local ShopFrame = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.ShopFrame
local shopui = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Frame.ShopGUI 
local buttonframe = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Frame.ShopButton.Frame
0
Thanks so much! It works! EmeraldRailYT 8 — 2mo
Ad

Answer this question