Today I made a Shop GUI. It opens in studio, but in game it doesn't open no matter how many times I click. Any help? (I used a LocalScript fyi)
repeat wait() Player = game.Players.LocalPlayer Button = script.Parent Item = game.ReplicatedStorage:FindFirstChild("GravityCoil") Cost = 50 Money = Player.leaderstats.Money until Button.MouseButton1Down:connect(function(purchase) if Money.Value > (Cost - 1) then Money.Value = Money.Value - Cost local a = Item:Clone() a.Parent = Player.Backpack local b = Item:Clone() b.Parent = Player.StarterGear end end)
I believe your problem is that you're not letting everything load in quick enough for it to work properly in the script.
Try this:
repeat wait() Player = game.Players.LocalPlayer Button = script.Parent Item = game.ReplicatedStorage:WaitForChild("GravityCoil") --Method of waiting for it to load in Cost = 50 repeat wait() until Player.leaderstats --Different method of waiting for them to load in repeat wait() until Player.leaderstats.Money Money = Player.leaderstats.Money until Button.MouseButton1Down:connect(function(purchase) if Money.Value > (Cost - 1) then Money.Value = Money.Value - Cost local a = Item:Clone() a.Parent = Player.Backpack local b = Item:Clone() b.Parent = Player.StarterGear end end)
Anyways, I believe the script should work now if everything else is correct the way it is.
Hope this helped, and if you have any further problems/questions, please leave a comment below :P