Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When i jump it won't add a jump in the leaderstats . How do i fix it ?

Asked by
Komas19 34
5 years ago

Help me please i want to create a simulator

01while wait(.5) do
02        local children = game.Players:GetChildren()
03        for i = 1, #children do
04            if children[i].Character ~= nil then
05            local hum = children[i].Character.Humanoid
06            hum.JumpPower = children[i].leaderstats.Jump.Value/3.12
07            if game.Players.LocalPlayer.Character.Humanoid.Jump == true then
08                game.Players.LocalPlayer.leaderstats.Jump.Value = game.Players.LocalPlayer.leaderstats.Jump.Value +1
09            end
10        end
11    end
12    end

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 4 years ago

Don't use loop. Just detect when the player is jumping by using :GetPropertyChangedSignal()

use Players.PlayerAdded to get player and use Player.CharacterAdded to get player's character

01game.Players.PlayerAdded:Connect(function(plr)
02    plr.CharacterAdded:Connect(function(char)
03        local hum = char.Humanoid
04        hum:GetPropertyChangedSignal("Jump"):Connect(function()
05            if hum.Jump == true then
06                plr.leaderstats.Jump.Value = plr.leaderstats.Jump.Value +1
07                hum.JumpPower = plr.leaderstats.Jump.Value/3.12
08            end
09        end)
10    end)
11end)

Also change the script from LocalScript to ServerScript

0
You should check if event occures because of the Jump value is false, or true Spjureeedd 385 — 5y
0
The Value is at 1 Komas19 34 — 5y
0
it's won't work Komas19 34 — 5y
0
oh thank you I forgot to add check if Jump is true or not Mr_m12Ck53 105 — 5y
View all comments (4 more)
0
can you edit the anwser ? It's will be more easier for me Komas19 34 — 5y
0
@Komas19 ok Mr_m12Ck53 105 — 4y
0
Won't work Komas19 34 — 4y
0
@Komas19 ok try char.Humanoid.Jump instead of GetPropertyChangedSignal Mr_m12Ck53 105 — 4y
Ad

Answer this question