If you dont understand the character just spam jump in mid air and he never fell back until i stop holding space bar .
Here is the script of the client :
while wait(1) do -- I have done this so it doesn't spam de Remote Event
if player.Character.Humanoid.MoveDirection.Magnitude >0 then -- This is for the speed training
game.ReplicatedStorage.SpeedEvent:FireServer(player)
end
end
UIS.JumpRequest:Connect(function() -- This is for the Jump training
game.ReplicatedStorage.JumpEvent:FireServer(player)
end)
Here is the Server Script :
game.ReplicatedStorage.JumpEvent.OnServerEvent:Connect(function(player)
local debounce = game.ServerStorage.Debounces[player.Name]
if not debounce.Value then
debounce.Value = true
player.StatsFolder.JumpValue.Value = (player.StatsFolder.JumpValue.Value + 1)
player.Character.Humanoid.JumpHeight = (player.StatsFolder.JumpValue.Value / 2)
wait(1)
debounce.Value = false
end
end)
I searched for long time how to fix it but i didn’t find one Thank you !
-VokarouYT
Upon initial analysis, this code is going to get buggy and probably pretty laggy very quickly.
Lets start by fixing your client script.
while wait(1) do -- I have done this so it doesn't spam de Remote Event
if player.Character.Humanoid.MoveDirection.Magnitude >0 then -- This is for the speed training
game.ReplicatedStorage.SpeedEvent:FireServer(player)
end
-- THIS IS THE PROBLEM LINE VVVV
UIS.JumpRequest:Connect(function() -- This is for the Jump training
game.ReplicatedStorage.JumpEvent:FireServer(player)
end)
end
The spot I outlined as a “problem” is definitely going to be a problem for you. Firstly, you’re adding a new event listener EVERY SECOND. This means if that event happens, you could potentially have millions of events firing. The solution to that is to move this:
UIS.JumpRequest:Connect(function() -- This is for the Jump training
game.ReplicatedStorage.JumpEvent:FireServer(player)
end)
Outside the while loop.
As for what else you are trying to accomplish, can you please elaborate? The language used as well as what you want to do is a bit confusing.