I am creating a system which displays your achievements in game with a scrolling frame. It works by simply clicking an imagebutton and it opening the gui. All is well and good, no errors however testing it isn't the greatest so far.
I noticed that when I click the imagebutton the gui does not open. I had a look at the frame for the gui and it told me it was visible in properties? I can't see anything! I can open it in studio using properties but not in game when I click the imagebutton.
Anyway, here is my script:
local gui = game.StarterGui.Achievements.ScrollingFrame script.Parent.MouseButton1Up:Connect(function() if gui.Visible == false then gui.Visible = true else gui.Visible = false end end)
All UI objects in StarterGui get replicated to the player gui located in the player object. (This applies to all services in the explorer that begin with 'Starter')
Insert a LocalScript into StarterPlayerScripts located in StarterPlayer.
write the following code:
local player = game.Players.LocalPlayer -- getting the client local playerGui = player:WaitForChild("PlayerGui") -- PlayerGui is located in every client's player object local imageButton = playerGui.ScreenGui.ImageButton -- use playerGui then define the path to imageButton local scrollFrame = playerGui.ScreenGui.ScrollingFrame -- use playerGui then define the path to scrollingFrame imageButton.MouseButton1Click:Connect(function() -- I go with mousebutton1click but you can do what you prefer if scrollFrame.Visible == false then -- checks whether it's false scrollFrame.Visible = true -- if true sets visible to true else -- if otherwise scrollFrame.Visible = false -- sets visible to false end end)
If it doesn't work or shows an error just reply cause I haven't tested it.