So, Im making a game about jumping and I want to set the gravity to a number when the player is ascending after jumping and set another gravity for when the player is descending, so It doesnt take too long for the player to land again.
This is the part of the script I need help with
local debounce = false local character = script.Parent local humanoid = character:WaitForChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(character) local leaderstats = player:WaitForChild("leaderstats") local jumps = leaderstats.Jumps print("Found leaderstats") humanoid.UseJumpPower = true debounce = false local graviti = Instance.new("IntValue") graviti.Value = 1000 local graviti2 = graviti.Value humanoid.Jumping:Connect(function(Start) if humanoid.JumpPower >= 1000 and game.Workspace.Gravity > 50 then game.Workspace.Gravity = game.Workspace.Gravity - 5 jumps.Value = jumps.Value + 1 print("ok") graviti2 = graviti2 - 5 print(graviti2) wait(1) humanoid.StateChanged:Connect(function(old,new) if new == Enum.HumanoidStateType.Freefall then game.Workspace.Gravity = 1000 print("Falling") end end) humanoid.StateChanged:Connect(function(old,new) if new == Enum.HumanoidStateType.Landed then game.Workspace.Gravity = graviti2 print("landed") end end) end end)