Hi guys, I’d like to know how to use the mouse position with velocity to throw a part away In the direction of the mouse position, could someone help me with that?
I’m still learning… Thanks you guys
Hi guys, I’d like to know how to use the mouse position with velocity to throw a part away In the direction of the mouse position, could someone help me with that?
I’m still learning… Thanks you guys
Assumming that you’ve got the Mouse’s Position in the Server Script once fired, we can do:
local MouseVelocity = CFrame.new(Player.Character.HumanoidRootPart.Position - MousePosition)
Part.CFrame = MouseVelocity
Part.Velocity = Part.CFrame.LookVector * 25 --Adding will increase the speed, while subtracting will decrease the speed
This is just a example though, but you can experiment around with this
And to slow down that speed slowly with a for, how could I do that?
Do you mean a for loop to make slow this?
for i = 25, 1, -1 do
Part.Velocity = Part.CFrame.LookVector * i
end
Thanks a lot guys, I’m going to test the code!