Code:

local ray = Ray.new(char.HumanoidRootPart.CFrame.p, mouse.p)


while true do
	wait()
	trident.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,2.5,0)
	trident.CFrame = CFrame.new(trident.CFrame.p  ,  ray.Direction)*CFrame.Angles(0,math.rad(180),0)
end

I tried to make this trident constantly point where my mouse was pointing before I launch it. The problem here is that when I fire the command, it would only constantly point at the last thing I pointed at, not where my mouse is currently. How do I fix this?

2 comments

0

Put the ray into the while loop. This will fix it because you are updating the mouse's position and humanoidrootpart's position.

0

I already tried that, didn't work