You can write your topic however you want, but you need to answer these questions:
-
I am trying to make a truck that when tweened moves with boxes
-
When i tween truck it moves but the boxes inside doesn’t
BEFORE
AFTER
Inside workspace
Code
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local Model_X = script.Parent.Position.X
local Model_Y = script.Parent.Position.Y
local Model_Z = script.Parent.Position.Z
local Model_Orientation_X = script.Parent.Orientation.X
local Model_Orientation_Y = script.Parent.Orientation.Y
local Model_Orientation_Z = script.Parent.Orientation.Z
local function Move_Truck()
if Model_Orientation_Y == 90 then
Model_Z = Model_Z + 30
end
if Model_Orientation_Y == -90 then
Model_Z = Model_Z - 30
end
if Model_Orientation_Y == -180 then
Model_X = Model_X + 30
end
if Model_Orientation_Y == 180 then
Model_X = Model_X - 30
end --this part used to know in what direction the truck will be
local tween = TweenService:Create(script.Parent, tweenInfo, {Position = Vector3.new(Model_X,Model_Y,Model_Z)})
tween:Play()
end
Move_Truck()
- I have read before other solutions how to tween models but I haven’t quiet understand them since non of them worked for me.