Hello
I’m trying to make a Dive Kick move, but the raycast seems to lag really hard.
I wanted to know if there’s a better way to make this or to optimize it.
The code basically makes a raycast in the dive direction, then waits until it hits something and deletes the dive velocity.
local done = false
repeat wait()
done = workspace:Raycast(
root.Position
,CFrame.new(root.Position,(root.CFrame * CFrame.new(0,-2,-2)).p).LookVector * 5.5
)
until done
RootVelocity:Destroy()
Demonstration of the delay:
Strangely enough, when you stand very close to a target, it does it correctly timed
(which i’m guessing is because it’s the first ray, which might why it is delaying but i am not entirely sure about this.)