ive been trying to make a system where players can jump around to do a “dash” and i use humanoid.movedirection to dictate where the player is going, only issue is, at some angles it doesnt jump straight
script runcontext client
elseif Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
--HumanoidRootPart.AssemblyLinearVelocity *= Vector3.new(0,1,0)
HumanoidRootPart:FindFirstChild("kerplunk"):Play()
if Humanoid.MoveDirection.Magnitude > 0.1 then
HumanoidRootPart:ApplyImpulse((Vector3.new(math.clamp(Humanoid.MoveDirection.X*500,-50,50),math.clamp(Humanoid.MoveDirection.Y*500,-50,50),math.clamp(Humanoid.MoveDirection.Z*500,-50,50))+Vector3.new(0,10,0))*10)
else
HumanoidRootPart.AssemblyLinearVelocity *= Vector3.new(1,0,1)
HumanoidRootPart:ApplyImpulse(Vector3.new(0,-600,0))
end
local RayResults = nil
repeat
task.wait()
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude
rayParams.FilterDescendantsInstances = {Character,Character:GetChildren()}
RayResults = workspace:Raycast(HumanoidRootPart.Position,Vector3.new(0,-4,0),rayParams)
until
RayResults ~= nil
HumanoidRootPart:FindFirstChild("landing"):Play()
Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
else
Animation.AnimationId = PunchTable[math.fmod(PunchCount,#PunchTable)+1]
end