Output says: Players.SashaPro336.PlayerGui.Shop.Frame.TextButton.LocalScript:4: invalid argument #1 to 'Connect' (RBXScriptSignal expected, got function)
The buttons local scripts:
button = script.Parent shop = game.StarterGui.Shop.Frame button.MouseButton1Click.Connect(function() shop.Visible = true --On other button false-- end)
I see the issue. Simple syntax error. Connect has a colon, not a period.
Also, you must use a local script. Each player has a "PlayerGui" which you must reference.
--Put this LocalScript inside the GUI button = script.Parent shop = game.Players.LocalPlayer.PlayerGui.Shop.Frame --You must reference the players PlayerGui button.MouseButton1Click:Connect(function() shop.Visible = true end)
Have a good day!
Hello, this was a mistake I did when I first started out so I am trying to explain it as I would to myself. So basicaly you have defined StarterGui and that is incorrect because the starterGui is just for the server to give the gui's to the players so when someone joins they get something called a PlayerGui and in there all the gui's form starterGui transfer.
Read More here: https://developer.roblox.com/en-us/api-reference/class/PlayerGui I also recommend to watch this video: https://www.youtube.com/watch?v=IFAVIFAHAxY&list=PLhieaQmOk7nK9ob348Yc_PTcIyHjDCnem&index=2&ab_channel=TheDevKing
button = script.Parent -- this will be your TextButton shop = game.StarterGui.Shop.Frame -- This is actually not the player's gui this is the gui that every player gets to explain it further StarterGui Is basically just a storage for all the gui's and when a player joins he gets a copy of the gui in StarterGui button.MouseButton1Click.Connect(function() shop.Visible = true -- so this is actually referering to StarterGui (server) insted of PlayerGui Witch is for the player // client. end) -- Solution button = script.Parent -- TextButton button.MouseButton1Down:Connect(function(player) -- in this argument we are passing player wich just means we get his game.Players.playernamehere local OurPlayersGui = player.PlayerGui.Shop.Frame -- this is where the gui for the player is OurPlayersGui.Viseble = true -- makes it so you can see the frame end)
If there was anything you didnt understand please tell me and I will try better If it did help you please accept my answer.