Tween not working

I’ve studied the code for like a hour and I have no idea why it doesn’t work

(local script)

TweenService = game:GetService("TweenService")

OpenTweenInfo = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)

CloseTweenInfo = TweenInfo.new(0.5,Enum.EasingStyle.Bounce,Enum.EasingDirection.In,0,false,0)

DoorA = game.Workspace.Doors.Doors.DoorA

DoorAOpen = game.Workspace.Doors.DoorsOpen.DoorA

DoorAClosed = game.Workspace.Doors.DoorsClosed.DoorA

DoorB = game.Workspace.Doors.Doors.DoorB

DoorBOpen = game.Workspace.Doors.DoorsOpen.DoorB

DoorBClosed = game.Workspace.Doors.DoorsClosed.DoorB

DoorC = game.Workspace.Doors.Doors.DoorC

DoorCOpen = game.Workspace.Doors.DoorsOpen.DoorC

DoorCClosed = game.Workspace.Doors.DoorsClosed.DoorC

Vent = game.Workspace.Doors.Doors.Vent

VentOpen = game.Workspace.Doors.DoorsOpen.Vent

VentClosed = game.Workspace.Doors.DoorsClosed.Vent

DoorATweenOpen = TweenService:Create(DoorA,OpenTweenInfo,{CFrame = DoorAOpen.CFrame})

DoorBTweenOpen = TweenService:Create(DoorB,OpenTweenInfo,{CFrame = DoorCOpen.CFrame})

DoorCTweenOpen = TweenService:Create(DoorC,OpenTweenInfo,{CFrame = DoorBOpen.CFrame})

VentTweenOpen = TweenService:Create(Vent,OpenTweenInfo,{CFrame = VentOpen.CFrame})

DoorATweenClosed = TweenService:Create(DoorA,CloseTweenInfo,{CFrame = DoorAClosed.CFrame})

DoorBTweenClosed = TweenService:Create(DoorB,CloseTweenInfo,{CFrame = DoorCClosed.CFrame})

DoorCTweenClosed = TweenService:Create(DoorC,CloseTweenInfo,{CFrame = DoorBClosed.CFrame})

VentTweenClosed = TweenService:Create(Vent,CloseTweenInfo,{CFrame = VentClosed.CFrame})

Doors = {

DoorA = true,

DoorB = true,

DoorC = true,

Vent = true,

}

UIS = game:GetService("UserInputService")

--DoorATweenOpen:Play()

DoorATweenOpen:Play()

UIS.InputBegan:Connect(function(Input)

if Input.KeyCode == Enum.KeyCode.A then

DoorATweenOpen:Play()

end

if Input.KeyCode == Enum.KeyCode.W then

DoorBTweenOpen:Play()

end

if Input.KeyCode == Enum.KeyCode.D then

DoorCTweenOpen:Play()

end

if Input.KeyCode == Enum.KeyCode.S then

VentTweenOpen:Play()

end

end)

UIS.InputEnded:Connect(function(Input)

if Input.KeyCode == Enum.KeyCode.A then

DoorATweenClosed:Play()

end

if Input.KeyCode == Enum.KeyCode.W then

DoorBTweenClosed:Play()

end

if Input.KeyCode == Enum.KeyCode.D then

DoorCTweenOpen:Play()

end

if Input.KeyCode == Enum.KeyCode.B then

VentTweenClosed:Play()

end

end)

I pretty much checked every pixel at this point.

Can you tell us what is the error? It’s really hard if we have to analyze it without any errors.

There is no errors. console completely squeeky clean

Did this door tween plays? You can show us a video of play testing the game.


As you can see it doesn’t do anything

Can I know why are you doing this on the client?

Because I want the doors to have key binds (WASD), and it’s probably going to be a single player game anyway

Ok, clearly you aren’t tweening the doors to their destination.

{CFrame = VentOpen.CFrame} --Bruh this ain't goin anywhere

Add a Vector3.new() or * CFrame.Angles after the VentOpen.CFrame like such:

TS:Create(Door1,TI,{CFrame = Door1.CFrame + Vector3.new()}) 
--or
TS:Create(Door1,TI,{CFrame = Door.CFrame * CFrame.Angles()})
--Changed a little the name's to make it clearer.

Also, weld each part together and group them into models, since this script was very hard to read, and will very much decrease the time you need to take in writing down everything.

PS: Make the primarypart in the model the “center” of the tween, and only anchor that.

EDIT: Made an edit.

I forgot to position the open parts…

1 Like

Excuse me, I did not see the first parameter, this would work in theory.

However I wouldn’t recommend this because if the part your tweening it to is also moving during this tween, it is going to end up in a location that you don’t want it to be. I recommend using an absolute value instead.