I am trying to get a welded part to look at a certain location however the tween I use does nothing to the orientation of the welded part. This is the current tween I am using to do so.
local info1 = TweenInfo.new(dt,Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local weld1 = turret.Base.BasePart.Pivot
local part1 = weld1.Part1
ts:Create(part1, info1, {CFrame = CFrame.new(weld1.Part1.CFrame.Position,location)}):Play()
You can’t change a welded part’s orientation like this, however you can tween weld1
object and also use C1
property in the goals table, not CFrame
.
I tried to change the code to this and the result is a little strange
local info1 = TweenInfo.new(dt,Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local weld1 = turret.Base.BasePart.Pivot
ts:Create(weld1, info1, {C1 = CFrame.new(Vector3.new(0,0,0),location)}):Play()
robloxapp-20220821-2356187.wmv (1.0 MB)
I don’t understand what is strange about it?
the turret should be aiming toward the center of the larger gui but acts like it is inversed.
Did you use the turret gui position to world position or the mouse position?
the location is the mouse hit position
You should be setting the turret gui position to the mouse position.