Hello! I need help with my cylinder rotation script, what I want to achieve is that the cylinder moves 360 degrees depending on where the other part is, the problem is that the cylinder does not move as it should.
This is an example of how it should move:
The cylinder should see the other part, but it is not exactly what happens, sometimes if the part is a little upwards the cylinder moves looking up but that should not happen, the only thing I want is for the cylinder to be move 360 degrees sideways depending on where the part is.
Here is my scipt:
while true do
local ts = game:GetService("TweenService")
local tinfo = TweenInfo.new(3)
local part = script.Parent
local Part2 = script.Parent.Parent.Part2
local properties = {CFrame = CFrame.new(part.CFrame.Position, Part2.CFrame.Position) * CFrame.Angles(0, 0, math.pi/2)}
local tween = ts:Create(part,tinfo,properties)
tween:Play()
tween.Completed:Wait()
end
Any help is appreciated