✓ Accepted answer
The answer above is correct, but it's not well explained and he also used :FindFirstChild() incorrectly.
Here is a few notes you should read:
- Do not use
FindFirstChild for any game service. Especially PlayerGui. When the player join's the PlayerGui is 100% inside of the player. And whatever is in StarterGui Is cloned into the PlayerGui
- use
:WaitForChild() in variables, WaitForChild waits for a certain object to load in. With a variable that Contain's WaitForChild. It will help the system find the objects. Without :WaiTForChild, it may work in studio but not in game and will nil the objects.
- You DO NOT Need to set a button active or not. If the visibility of the button is false, it won't fire on click.
Study those notes, now here's a fix;
MAKE SURE THIS IS A LocalScript
local button = script.Parent
local a = 0
local plr = game.Players.LocalPlayer
local ob = plr.PlayerGui:WaitForChild('Shop').OpenShop.ActualOpen.Buttons
button.MouseButton1Click:Connect(function()
ob.Close.Visible = true
ob.Gamepases.Visible = true
ob.SlightSpeedBoost.Visible = true
ob.Skip1Level.Visible = true
ob.Skip3Levels.Visible = true
ob.Tips.Visible = true
end)
Make sure all the buttons have there active set to True. This won't effect the buttons.
Lastly a few more notes to study:
- When using :connect(function(), make sure connect has a capital C, a lower case c is deprecated.
- if the button is active or not will only affect the button if the button visibility is true.
- Use WaitForChild
- when a parent is loaded, all the childs are 100% loaded.
Good luck and have fun developing!
2 comments
Any errors?
No, it says it should be running.