So I am trying to make an obby and I have stages. In the leaderboard, I have 2 values: Coins and levels. So what I am trying to explain is that when the player completes the level and stands on the checkpoint, the levels value should increase as the player completes the level. How can I achieve this?
✓ ANSWER ACCEPTED
How to I increase the levels value on the leader board if the player completes a level in an obby?
1 answer
✓ Accepted answer
well, just add a script in the brick that will be touched to level up, and add an integer value(Int value) in the brick and give it a value of the level; then do the following
script.Parent.Touched:connect(function(touching)
local parent = touching.Parent
locla humanoid = Parent:FindfirstChild("Humanoid")
local player;
if humanoid then
player = game.Players:GetPlayerFromCharacter(parent)
if player then
local leaderstats = player.leaderstats
local level = leaderstats.Level -- rename level to whatever the level value is
named
level.Value = script.Parent.LevelValue -- change this to the name of the number value in the brick
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
You don't need to check for a Humanoid if you're using GetPlayerFromCharacter(). If GetPlayerFromCharacter() returns a player, it means that the character automatically has a Humanoid.
Also: "just add a remoteevent in replicatedstorage", you don't actually need a RemoteEvent. The server can access the children of a player.
good catch, i was meaning to answer a question with a complex system that automates all the leveling, but after thinking about it, I decided to go basic, and forgot to remove that. Thanks
I am also at school, and I was running out of time when i was writting this, so i guess that contributes to the errors