Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do I make it so I can buy stuff in my game with in game money?

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

0

Have you ever tried making a script or do you just rely on other people to spoonfeed you

0

You know you could just -Cash.Value when they press a button to buy smt and just clone tool from server storage

0

I am only here to give idea on how to. Maybe next time, try it yourself through trial and error.

0

the only part i need is the part to give a tool

0

Hi rainbow, i am working on a script for you that will work!

0

ok thanks!

1 answer

✓ Accepted answer

Hi, I could not manage to make a script, But all you need to do is make a clone of the item, and put it in the players

"Backpack" and "StarterGear"

This discussion is preserved as it was. New answers, comments, and votes are closed.