I have a tool shop gui and for some reason the script inside of the buy button doesnt work here is the script (it is ss)
local btn = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local Sword = ReplicatedStorage:FindFirstChild("Noob Sword") btn.MouseButton1Click:Connect(function(player) if player.leaderstats.Currency.Value > 199 then local tool = Sword:Clone() tool.Parent = player.Backpack end end)
Try this
local btn = script.Parent plr = game.Players.LocalPlayer btn.MouseButton1Click:Connect(function() if game:GetService("ReplicatedStorage"):FindFirstChild("Noob Sword") then if plr.leaderstats.Currency.Value >= 200 then plr.leaderstats.Currency.Value = plr.leaderstats.Currency.Value - 200 local tool = game:GetService("ReplicatedStorage")["Noob Sword"]:Clone() tool.Parent = plr.Backpack end end end)
from a local script as gui user input is mostly handled from the client.