Hello! I will for the first time post.
-
What do you want to achieve? Keep it simple and clear!
I want to use Tween for the body parts of A-chassis.
It is used for bus doors. -
What is the issue? Include screenshots / videos if possible!
The door parts are installed on the body, they do not move at all. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
If installed in Misc, Anchor will come off and parts will fall.
<!>Works fine on Base.↓
This is the script that opens the door.
--open
local clickDetector = script.Parent.ClickDetector
local onsw = script.Parent
local ofsw = script.Parent.Parent.Off
--door
local d1 = script.Parent.Parent.Parent.door.door1
local d2 = script.Parent.Parent.Parent.door.door2
local Service = game:GetService("TweenService")
local info = TweenInfo.new(0.3)
local info2 = TweenInfo.new(2)
local d1posX = script.Parent.Parent.Parent.door.door1.Position.X
local d1posY = script.Parent.Parent.Parent.door.door1.Position.Y
local d1posZ = script.Parent.Parent.Parent.door.door1.Position.Z
local d2posX = script.Parent.Parent.Parent.door.door2.Position.X
local d2posY = script.Parent.Parent.Parent.door.door2.Position.Y
local d2posZ = script.Parent.Parent.Parent.door.door2.Position.Z
--
function onMouseClick()
onsw.Transparency = 1.0
ofsw.Transparency = 0.0
--moving door
local Change = {Position = Vector3.new(d1posX,d1posY,d1posZ+0.5)}
local Tween = Service:Create(d1,info,Change)
Tween:Play()
local Change = {Position = Vector3.new(d2posX,d2posY,d2posZ+0.5)}
local Tween = Service:Create(d2,info,Change)
Tween:Play()
wait(0.2)
local Change = {Position = Vector3.new(d1posX+4,d1posY,d1posZ+0.5)}
local Tween = Service:Create(d1,info2,Change)
Tween:Play()
local Change = {Position = Vector3.new(d2posX-4,d2posY,d2posZ+0.5)}
local Tween = Service:Create(d2,info2,Change)
Tween:Play()
--
end
clickDetector.MouseClick:connect(onMouseClick)
I’m Japanese and I can’t speak English well. sorry.