Hello! I need to lock the Z axis on my light tween. However, I’m not sure how to do it.
Here’s my code: (it’s segmented)
local TweenService = game:GetService("TweenService")
local Body = script.Parent["Body"]
local PrimaryPart = Body.Head["Primary"]
local Pan = Body.Pan["BasePart"]
local target = workspace.Target
local lens = Body.Head["Lens"]
local TargettingModeEnabled = false
local PausedForTweening = false
function Move(Speed, CFrameValue, Target, EasingStyle, EasingDirection, Pause)
local tweenInfo = TweenInfo.new(Speed, EasingStyle, EasingDirection)
local tween
if TargettingModeEnabled then
tween = TweenService:Create(PrimaryPart, tweenInfo, {CFrame = CFrame.lookAt(PrimaryPart.Position, Target.Position)})
else
tween = TweenService:Create(PrimaryPart, tweenInfo, {CFrame = CFrameValue})
end
if tween then
if Pause then PausedForTweening = true end
tween:Play()
if Pause then
tween.Completed:Wait()
PausedForTweening = false
end
end
end
while task.wait(0.5) do
Move(1, PrimaryPart.CFrame * CFrame.Angles(math.rad(math.random(-180, 0)), math.rad(math.random(-180, 0)), 0), nil, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, false)
end
All responses appreciated! Thank you!!!