Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local price = script.Parent.Parent.Price
- local tools = game.ReplicatedStorage:WaitForChild("Tools")
- local tool = tools:FindFirstChild(script.Parent.Parent.ItemName.Value)
- local player = script.Parent.Parent.Parent.Parent.Parent.Parent
- script.Parent.MouseButton1Click:connect(function()
- if player.leaderstats:FindFirstChild("Money").Value >= price.Value then -- Change "Money" to the name of your currency. Example: Cash
- player.leaderstats:FindFirstChild("Money").Value = player.leaderstats:FindFirstChild("Money").Value - price.Value
- local clone = tool:Clone()
- clone.Parent = player.Backpack
- -- Copy this code if you want the player to still have the tool even if he died
- local clone2 = tool:Clone()
- clone2.Parent = player.StarterGear
- end
- end)
Add Comment
Please, Sign In to add comment