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

How do you make a script for in game currency ( Not robux) to be sent to the player?

I'm making a Role playing game. And I want players to play for a certain amount of time ( ex. 1 min) to get some in game points to buy houses, gear, or items. I wanna know how to make a script, and help or recommendations? Thanks!

1 answer

✓ Accepted answer

First of all, you will need to make a leaderboard. Once you're there, you change the value to whatever you want to add it to. I'm assuming you don't know how to make a leaderboard, so I'll give you a bit of code and you should be able to script it from there.

game.Players.PlayerAdded:Connect(function(plr)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"
	stats.Parent = plr
	
	local currency = Instance.new("IntValue")
	currency.Name = "Money" -- change this to the name of your currency
    currency.Value = 0 -- change this to the starting amount of cash
    currency.Parent = stats
end)

If you really still don't know what to do, I highly suggest searching up loops on the Roblox API Reference (the guide).

Hint..!

for i,v in pairs(game.Players:GetChildren()) do
	v.leaderstats.Money.Value = v.leaderstats.Money.Value + 10
end

(In the future, please try coding it before posting on this website)

6 comments

0

Okay, thansk a lot. I do know scripting and coding though i just need to work on loop.

0

stats needs to be a folder, not an intvalue besides that, you got all of it right

0

Are you sure? I tested the leaderboard script and it does work. Although I have seen scripts that use a folder..

0

It works, i found out looping and now, it broke the games

0

Did you put a wait() in the loop..?

0

hmmmmmm

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