The error showed me this
wait(1)
if script.Parent.Parent.Parent.Parent.Parent:FindFirstChild(“MainParts”) then
script.Parent.Engine.Value = script.Parent.Parent.Parent.Parent.MainParts.Engine
end
local roll = script.Parent.Engine.Value
local Engine = script.Parent.Engine.Value
while game:GetService(“RunService”).RenderStepped:wait() do
script.Parent.union.Rotation = math.deg(math.atan2(Engine.CFrame.lookVector.y,Engine.CFrame.lookVector.y))
end
blokav
(blokav)
January 25, 2021, 8:22pm
#2
How are you getting ‘Engine’. If this is your full script then it is erroring because you didn’t define any Engine variable.
There is no such thing as “Rotation”, You meant “Orientation”
blokav
(blokav)
January 25, 2021, 8:24pm
#4
Make sure the value of script.Parent.Engine
is actually set to a part.
It now says [ invalid argument #3 (Vector3 expected, got number)]
blokav
(blokav)
January 25, 2021, 8:31pm
#6
That’s probably from trying to set the rotation. Rotation/Orientation is a vector3, not just one number.
Please format your scripts before posting them
The error is probably occurring because Engine
is nil
, make sure it has a value.
If you want to change the rotation of an object you would do this instead
part.CFrame = CFrame.new(part.Position) * CFrame.Angles(X, Y, Z) -- // You need to specify X, Y and Z in radians! you can do math.rad(num) to convert from degrees to radians. // --