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

How do can I add points when a player jumps?

Asked by 5 years ago

So here is the local script of where you get power..

wait(4)

while wait(.5) do

if game.Players.LocalPlayer.Character.Humanoid.JumpPower.Magnitude >0 then

workspace.Events.AddJump:FireServer()

end

end

So I understand if I put "MoveDirection" where it says "JumpPower" it will add power when I take steps.. but what would I put if I wanted it to add points when you jump?

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Just use Humanoid.Jumping

humanoid.Jumping:Connect(function(active)
    if not active then return end -- If they aren't jumping, stop the function here

    print('Player is jumping')
    -- Award points
end)

More info on HumanioidStates

Or to use your code explicitly

wait(4)

game.Players.LocalPlayer.Character.Humanoid.Jumping:Connect(function(active)
    if not active then return end

    workspace.Events.AddJump:FireServer()
end)

Just a note, I wouldn't store RemoteEvents or RemoteFunctions in Workspace

0
Thank you and yeah I honestly don't know why I have them in workspace ChefDevRBLX 90 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Your question actually need more explanation. But I guess you are trying to add point when the player jumps (Spacebar pressed).

I actually have 2 methods.

1 ) Use UserInputService to detect the 'Spacebar' being pressed , and give the player points. - But this will also increase the Player's point even if you pressed spacebar rapidly , but I sure you can add debounce.

2) Use HumanoidStateType. It been awhile since I use this 'function' , but I'm sure you can detect whether the Player is 'Falling' , 'Jumping' , etc.

0
Can you give an example script possibly? ChefDevRBLX 90 — 5y

Answer this question