player = script.Parent.Parent.Parent.Parent.Parent money = player.leaderstats.Cash price = 5 tool = game.Lighting:findFirstChild("Tool") function buy() if money.Value >= price then money.Value = money.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)
What you need to do before running this script: 1. Make a bool value inside the script called AlreadyPurchased 2. Use the script below
Script:
player = -- Path to player here -- money = player.leaderstats.Cash price = 5 tool = -- Path to tool -- local Value = script.AlreadyPurchased function buy() if script.AlreadyPurchased == true then return else if money.Value >= price then money.Value = money.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)
Also if you like you can add a datastore so it saves. Hope this helps!