I made a shop GUI but instead of using "leaderstats" as the payment for an item and want to use my own currency gui. The scripts for both are down below.
Script for my own personal GUI:
fol = Instance.new("Folder", game.Workspace) fol.Name = "Data" game.Players.PlayerAdded:connect(function(plr) plrfol = Instance.new("Folder", fol) plrfol.Name = plr.Name val = Instance.new("NumberValue", plrfol) val.Value = 0 val.Name = "Socks" end)
game.Players.PlayerRemoving:connect(function(plr) fol[plr.Name]:Destroy() end)
Script for shop button:
player = script.Parent.Parent.Parent.Parent.Parent Cash = player.leaderstats.Cash -- Leaderstat: Change price = 30 -- Price :Change tool = game.Lighting:findFirstChild("GrapplingHook") -- Weapon Name: Change
--DO NOT CHANGE ANYTHING BELOW HERE function buy() if Cash.Value >= price then Cash.Value = Cash.Value - price local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear
end end script.Parent.MouseButton1Down:connect(buy)