Hello Developers !
Recently I’ve been trying my hardest to create a season pass / XP level system which includes rewards in my Roblox game
unfortunately i cant find any tutorials with a system like this or any help anywhere about this
Also it would be cool for were the XP increases each time and quests go along with it
Can Anyone reply with help or tutorials or information that will help me ?
Here Is Something I Want To Make Similar To
4 Likes
To be able to make somewhat of an elaborate system like this it would be helpful to start with the organization of this system, since coding is just problem solving and the more you break it down into little manageable bits and pieces the easier it becomes.
So the way I would attack a system like this using a modulated layout using modulescripts would to have a main EXP or XP system module which will allow you to set and get and save the amount of xp a certain user has.
Once you make this i would make something like a reward module and everytime a users exp increases or something a function in that module is called which will check if they are eligible for any sort of reward. This could be something along the lines of a lookup table which has the names of the rewards according to each level and you could just access it like this.
local rewardFunctions = {
["MoreCoins"] = function(player)
print("Coin update")
player.Coins.Value += 15 -- or something like that idk
end,
["MoreGems"] = function(player)
print("Gem Update")
player.Gems.Value += 15
end
}
local rewards = {
[15] = {false, "MoreCoins"},
[30] = {false, "MoreGems"}
}
local function checkRewards(player)
for i,v in pairs(rewards) do
if player.Level.Value >= i and not v[1] then
v[1] = true -- this will mean they unlocked it
rewardFunctions[v[2]](player) -- this will just run the function once they unlock it
end
end
end
Than you just datastore their level and what tiers and stuff they have unlocked. I hope that helped you understand how to make something like this better.
7 Likes