So basically, I’ve been having issues with a script I have.
What this script basically does is just don’t allow you to move in the air when jumping. I kinda want this script to just, when you jump it doesn’t allow you to move in the air, but I want it so if you hit something like a wall it just inverts the lastvelocity and bounces you back to place.
I need this script for an April 2007 roblox simulator I’m making (which you can find here) since the client for that era also had that exact feature. I’ve been trying to modify the script I mentioned earlier countless times and failing catastrophically.
Here’s the script I’m talking about.
local humanoid = script.Parent:WaitForChild("Humanoid")
local rootpart = script.Parent:WaitForChild("Torso")
local lastvelocity = Vector3.new(0,0,0)
local locking = false
humanoid.Jumping:Connect(function()
locking = true
end)
game:GetService("RunService"):BindToRenderStep("jumpLock",Enum.RenderPriority.Character.Value+1,function()
if humanoid and rootpart then
if humanoid:GetState() == Enum.HumanoidStateType.Freefall and locking == true then
humanoid:Move(lastvelocity,false)
humanoid.AutoRotate = false
elseif humanoid:GetState() == Enum.HumanoidStateType.Running or humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics then
lastvelocity = rootpart.Velocity/humanoid.WalkSpeed
humanoid.AutoRotate = true
locking = false
lastvelocity = rootpart.Velocity/humanoid.WalkSpeed
humanoid.AutoRotate = true
locking = false
else
humanoid.AutoRotate = true
end
end
end)