Hey guys I've been playing around with body forces and body gyros for a few hours not to no success. I want a brick to go to where i click gradually and stop as soon as it reaches where i click.
Currently i have a system which causes the brick to move to where i want but wont stop till after the point as it needs to slow down and its also currently rotating like crazy, i want it to face the direction it is traveling.
Below is my code.
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local speed = 20
local selectedUnit = nil
UIS.InputBegan:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if mouse.Target then
if mouse.Target.Name == "Unit" then
selectedUnit = mouse.Target
elseif mouse.Hit then
if selectedUnit then
print("move unit")
--selectedUnit.CFrame = mouse.Hit
print(selectedUnit:GetChildren())
selectedUnit.BodyGyro.CFrame = CFrame.new(selectedUnit.Position*Vector3.new(1,0,1), mouse.Hit.p*Vector3.new(1,0,1))
selectedUnit.BodyVelocity.Velocity = CFrame.new(selectedUnit.Position, mouse.Hit.p).lookVector * speed
repeat wait(0.5) until (selectedUnit.Position - mouse.Hit.p).magnitude < 3
selectedUnit.BodyVelocity.Velocity = Vector3.new(0,0,0)
selectedUnit = nil
end
end
end
end
end)
Any suggestions, improvements, tips or even a complete re-haul of what i'm attempting would be appreciated.

2 comments
i wouldnt know how to do it myself but assuming you know how to do it just do this; create an invisible part at the point where the player clicked, then set the BodyPosition of the part you are trying to move to the placed parts position, and delete the part
Thanks for the input but this is not quite what i need.