leaderstats script
local prest = workspace:WaitForChild("Prestige")
local close = workspace:WaitForChild("Close")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new('Model')
leaderstats.Name = 'leaderstats'
leaderstats.Parent = player
local reb = Instance.new("IntValue", leaderstats)
reb.Name = "Rebirths"
reb.Value = 0
local costmult = Instance.new("IntValue", player)
costmult.Value = 1
costmult.Name = "costmult"
local JumpPower = Instance.new('NumberValue')
local char = player.Character or player.CharacterAdded:Wait()
local hum = char.Humanoid
JumpPower.Value= 0
JumpPower.Parent=leaderstats
JumpPower.Name='Score'
hum.Changed:Connect(function()
JumpPower.Value = 0 + math.floor((hum.JumpPower*20-1000)+ 0.5)
end)
player.Character.Humanoid.Died:Connect(function()
player.CharacterAdded:Connect(function()
player.Character.Humanoid.JumpPower = JumpPower.Value/20+50+(0.05*((player.leaderstats.Rebirths.Value+1)))-0.05
end)
end)
prest.onServerEvent:Connect(function(plr)
print(plr.costmult.Value)
if plr.leaderstats.Score.Value >= (1500*plr.costmult.Value) then
close:FireClient(plr)
plr.Character.Humanoid.JumpPower = 50
plr.leaderstats.Score.Value = plr.leaderstats.Score.Value- (1500*costmult.Value)
plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value +1
costmult.Value = costmult.Value*2
JumpPower.Value = 0 + math.floor((hum.JumpPower*20-1000)+ 0.5)
end
end)
end)
Points change script
local ReplicatedStorage = game:GetService('ReplicatedStorage')
ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
player.Character.Humanoid.JumpPower = (player.Character.Humanoid.JumpPower + (0.05*((player.leaderstats.Rebirths.Value+1))))
print(player.costmult.Value)
end)
This is the part of the leaderstats script I tried to preserve the Jump Power of the player
player.Character.Humanoid.Died:Connect(function()
player.CharacterAdded:Connect(function()
player.Character.Humanoid.JumpPower = JumpPower.Value/20+50+(0.05*((player.leaderstats.Rebirths.Value+1)))-0.05
end)
This script only works once then the Points on the leaderboard don't update. Also if they die for a second time it will revert their jump power to the value it was when they died for the first time.

1 comment
Also I suggest if the points are updating, to make sure the "RemoteEvent" in the second Server Script is actually being fired