Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 4 years ago

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

Log in to vote
0
Answered by
niroqeo 123
4 years ago

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)

0
Okay, thansk a lot. I do know scripting and coding though i just need to work on loop. fireyfoxninja21 9 — 4y
0
stats needs to be a folder, not an intvalue besides that, you got all of it right epicgnomer 15 — 4y
0
Are you sure? I tested the leaderboard script and it does work. Although I have seen scripts that use a folder.. niroqeo 123 — 4y
0
It works, i found out looping and now, it broke the games fireyfoxninja21 9 — 4y
View all comments (2 more)
0
Did you put a wait() in the loop..? niroqeo 123 — 4y
0
hmmmmmm fireyfoxninja21 9 — 4y
Ad

Answer this question