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

How would i make a one time bonus be given to a player?

Asked by
oSyM8V3N 429 Moderation Voter
6 years ago

I have a game, where BETA testers get a in game bonus which is +5 levels, and 2500 zeni. And i want it so when they join, they get the bonus only that one time, so they can't rejoin again and revive it over and over

I was thinking of making a script to where whenever the player is added to the game, it checks if a value in their data is true and if so it doesn't give them the bonus again

0
Which is, what you should do! hiimgoodpack 2009 — 6y
0
hiimgoodpack appears with another very useful tip ^ greatneil80 2647 — 6y
0
Alright, i'll try it out oSyM8V3N 429 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Make a datastore that will store the bool for if the player has been given the bonus when the player joins, if the player is not in the datastore then give him the bonus and add him

BonusStorage = game:GetService("DataStoreService"):GetDataStore("Bonus")

game.Players.PlayerAdded:connect(function(plr)
    if not BonusStorage:GetAsync(plr.UserId) then   
        plr.Data.zeni.Value = plr.Data.zeni.Value + 2500
        plr.Data.Level.Value = plr.Data.Level.Value + 5
        BonusStorage:SetAsync(plr.UserId,true)
    end
end)
0
Ohhh. I'm a little bit confuse though. Should i add a bool in my datastore? oSyM8V3N 429 — 6y
Ad

Answer this question