I am trying to make the head of an IK-robot tween up and down while moving. However, the tween pauses other CFrame actions done on other scripts. That’s why I want to know if it’s possible to add value to an Axis (ex: Z-Axis) specifically and not modify any other Axis.
What it looks like:
https://i.gyazo.com/cd351a9f8956ed1ce3424502e4a73e97.mp4
As you might’ve noticed, the robot stops moving briefly every time the tween plays.
My Code:
local TweenService = game:GetService("TweenService")
local tweenInfoUp = TweenInfo.new(0.75, Enum.EasingStyle.Linear)
local tweenInfoDown = TweenInfo.new(0.25, Enum.EasingStyle.Linear)
module.TweenObject = function(Object, tGoals)
local UpTween = TweenService:Create(Object,tweenInfoUp,{CFrame = tGoals.CFrame + Vector3.new(0,5,0)})
local DownTween = TweenService:Create(Object,tweenInfoDown,{CFrame = tGoals.CFrame})
local upTweenHead = TweenService:Create(Object.Parent.Head, tweenInfoUp, {CFrame = Object.Parent.Head.CFrame + Vector3.new(0, 2.5)})
local DownTweenHead = TweenService:Create(Object.Parent.Head,tweenInfoDown,{CFrame = Object.Parent.Head.CFrame})
UpTween:Play()
upTweenHead:Play()
UpTween.Completed:Connect(function()
DownTween:Play()
DownTweenHead:Play()
end)
end
The CFrame actions in another script:
while wait(0.001) do
Bot.Head.CFrame += Vector3.new(0,0,0.1)
end