Hey! I'm creating a game and I need help to do this: I first created a button where when we click on it the character jumps 8 meters. I also created a leaderboard. I would like to make that, when we click on the button, the leaderboard score increases by 1 and the character jumps 1 meter more. Theres the button script:
-- Parameters
local WAIT_TIME = .5
-- Services
Player = game:GetService("Players")
local button = script.Parent
local canActivate = true
local function playerJump()
if canActivate then
canActivate = false
local localPlayer = Player.LocalPlayer
local character = localPlayer.Character
local Humanoid = character:WaitForChild("Humanoid")
local oldJumpPower = Humanoid.JumpPower
Humanoid.JumpPower = 100
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
Humanoid.JumpPower = oldJumpPower
task.wait(WAIT_TIME)
canActivate = true
end
end
button.Activated:Connect(playerJump)
And the leaderboard script:
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Parent = plr
leaderstats.Name = "leaderstats"
local JumpPower = Instance.new("IntValue")
JumpPower.Value = 0
JumpPower.Parent = leaderstats
JumpPower.Name = "JumpPower"
end)
Thank you in advance for your answer! Cordially, Belox.

8 comments
Thank you so much! I just have a small request, how can I do so that the score of the scoreboard does not increase until the character has not touched the ground because there could be cheaters! Thank you in advance for your answer! Sincerely, Belox.
has or hasnt touched the ground, as in, once they jump and touch the ground, or once they jump, before they touch the ground?
Once they jump and touch the ground.
Yea, ill make one rq, hold on
Ok tanks!
I've tried lots of things, I don't know how, sorry :/
No problem! Thank you very much for all your help!
No Problem!