Here is the script I used to add money to my game. I want it so that if you buy something you get a tool.
local id = 1172399
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local Cash = Instance.new("StringValue",leaderstats)
Cash.Name = "Cash"
local doesOwn
local success, message = pcall(function()
doesOwn = game.MarketplaceService:UserOwnsGamePassAsync(player.UserId,id)
end)
if doesOwn then
Cash.Value = "Infinite"
print(player.Name.." owns the gamepass")
game.ReplicatedStorage.Notifications:FireClient(player,"You own the infinite money gamepass!")
else
print(player.Name.." does not own the gamepass")
game.ReplicatedStorage.Notifications:FireClient(player,"You do not own the infinite money gamepass.")
Cash.Value = 0
while wait() do
wait(10)
Cash.Value = Cash.Value + 25
end
end
end)

6 comments
Have you ever tried making a script or do you just rely on other people to spoonfeed you
You know you could just -Cash.Value when they press a button to buy smt and just clone tool from server storage
I am only here to give idea on how to. Maybe next time, try it yourself through trial and error.
the only part i need is the part to give a tool
Hi rainbow, i am working on a script for you that will work!
ok thanks!