Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do can I add points when a player jumps?

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

✓ Accepted answer

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

1 comment

0

Thank you and yeah I honestly don't know why I have them in workspace

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.

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

1 comment

0

Can you give an example script possibly?

This discussion is preserved as it was. New answers, comments, and votes are closed.