Tweening Model Not Working

So pretty much i’m trying to tween a elevator to move u and down, what I’m trying to do is make everything move with the primarypart put it will not work, here is the script and screenshot on what happens.

local TweenService = game:GetService("TweenService")

local model = workspace.ElevatorPanel
local TweenPart = model.PrimaryPart

for i, part in pairs(model:GetDescendants()) do 
	if part:IsA("BasePart") or part:IsA("MeshPart")  and (part ~= TweenPart) then 
		local Weld = Instance.new("WeldConstraint", part)
		Weld.Part0 = part
		Weld.Part1 = TweenPart
	end
end

local TweenInfo1 = TweenInfo.new(
	5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.In,
	0,
	false,
	0
)
local Goal1 = {
	CFrame = TweenPart.CFrame * CFrame.new(TweenPart.Size.Y + 0,0.1,0)
}

local Tween1 = TweenService:Create(TweenPart, TweenInfo1, Goal1)

wait(10)
Tween1:Play()
print("Playing tween")

So right now I don’t care that it’s moving forward I’ll adjust that later but this is all thats moving
image
the elevator button and the primarypart which is invisble and covers the whole model.

I don’t understand the goal here, you’re stating you want to tween a elevator up and down but the code states the elevator panel. I’m just a little confused that’s all?

2 Likes

wait(5)
print(“Reverse tween”)
Tween1:Reverse()
wait(10)
Tween1:Play()
print(“Playing tween”)
wait(5)
print(“Reverse tween”)
Tween1:Reverse()

I’m not entirely sure what I did wrong, if anyone is willing to help, that would be great.

I’m not sure what you want, but it seems like you want to move the elevator like a cage, and to do this, you can do something like this:
local TweenService = game:GetService(“TweenService”)
local model = workspace.ElevatorPanel
local TweenPart = model.PrimaryPart

local TweenInfo1 = TweenInfo.new(
5,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)

local Goal1 = {
CFrame = TweenPart.CFrame * CFrame.new(TweenPart.Size.Y + 0, 0.1, 0)
}

local Tween1 = TweenService:Create(TweenPart, TweenInfo1, Goal1)

for i, part in pairs(model:GetDescendants()) do
if part:IsA(“BasePart”) or part:IsA(“MeshPart”) and (part ~= TweenPart) then
local Weld = Instance.new(“WeldConstraint”, part)
Weld.Part0 = part
Weld.Part1 = TweenPart
end
end

Tween1:Play()
print(“Playing tween”)
wait(5)
print(“Reverse tween”)
Tween1:Reverse()

Tween1:Play()
print(“Playing tween”)
wait(5)
print(“Reverse tween”)
Tween1:Reverse()

1 Like

the guy im working with didnt wanna change his script using Elevator panel so just put everything into that model lol

I believe this is your problem, remove TweenPart.Size.Y and it should work.
Example of what the new goal would look like:

CFrame = TweenPart.CFrame * CFrame.new(0,20,0)

1 Like

omg thank you so much!!! I really appreciate this help your a life saver miss!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.