I have a game where i want players to have a higher jump power everytime they jump but my script isn't working right. Can somebody help me? This is my script:
local JumpPower = 50 local Player = script.Parent while wait() do if Player.Humanoid.jumping == true then repeat JumpPower = JumpPower + 0.01 Player.Humanoid.JumpPower = JumpPower print(JumpPower) until Player.Humanoid.jumping == false end end
But when i jump for some reason if Player.humanoid.jumping == true then
is always false.
This is the full script.
Hey check this link out. It is always more advisable to use an event than a loop. The way you can implement this is thus:
player.Character.Humanoid.StateChanged:Connect(function(oldState, newState) -- if newState is jumping then go forward otherwise do nothing end)
Hope this helps and have a great day scripting!
Make a KeyDown Event with the Space Key, and in the event do what you want it to do if it's pressed.
local JumpPower = 50 local Character = script.Parent Character.Humanoid.Jumping:Connect(function(active) -- parameter is if they're still jumping repeat JumpPower = JumpPower + 0.01 Character.Humanoid.JumpPower = JumpPower print(JumpPower) until not active -- repeat until stop jumping end)