Answered by
7 years ago Edited 7 years ago
I don't know if you want it to spend points but if you do here is the script, make sure to change out the parentheses with the answer to them (you will need to put it inside of a part in the game and get the tool you want from toolbox and put it inside ServerStorage):
02 | script.Parent.Touched:connect( function (hit) |
04 | local hum = hit.Parent:FindFirstChild( "Humanoid" ) |
05 | local a = hit.Parent.Name |
06 | if hum and game.Players:FindFirstChild(a).leaderstats.(whatever your money is called).Value > = (how much you wan't them to spend) then |
07 | game.Players:FindFirstChild(a).leaderstats.(whatever your money is called).Value = game.Players:FindFirstChild(a).leaderstats.(whatever your money is called).Value - (how much you want them to spend) |
08 | tool = game.ServerStorage.(whatever your tool is called).Clone() |
09 | tool.Parent = game.Players:FindFirstChild(a).Backpack |
if you don't have the leaderboard script, heres that:
1 | game.Players.PlayerAdded:connect( function (plr) |
2 | local leaderstats = Instance.new( "Folder" , plr) |
3 | leaderstats.Name = "leaderstats" |
5 | local (what you want your currency to be called) = Instance.new( "IntValue" , leaderstats) |
6 | (whatever you named that variable).Name = (what you want your currency to be called) |