I have my EXP and leveling system in place, I'm just confused on where to start with giving players EXP in the first place. How would I go about giving players EXP based on their play time, say 1 EXP every 30 seconds?
✓ ANSWER ACCEPTED
How to add EXP to a player over time?
1 answer
✓ Accepted answer
Here, we're going to use what's called a While Loop. Basically, what it does is it loops over a block of codes over and over again.
Check this out to know more about loops: https://developer.roblox.com/en-us/articles/Loops
BTW, back to the issue, here's how I would do it...
local players = game:GetService("Players") --gets the players
players.PlayerAdded:Connect(function(player) --checks if a player joins
local stats = Instance.new("IntValue", player) --creates the leaderboard
stats.Name = "leaderstats"
local exp = Instance.new("IntValue", stats) --creates the exp
exp.Name = "exp"
while true do --the while I was talking about
player.leaderstats.exp.Value = player.leaderstats.exp.Value + 1 --increases exp by 1 overtime
wait(30) --waits 30 seconds before increasing exp by 1 again
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you so much, I really appreciate it!