Help With Tweening A Model

I’m trying to tween a model for a sliding door I’m making. I’ve been getting the error “Unable to cast to Dictionary” and got stuck on what I was doing wrong. I’m making a grid placement system (or at least I’m going to try to) and it’s not a stationary door so the end positions will always be different. “doorLocation” is also the initial position of the door for the slide back tween. What did I do wrong?


local Detectionzone = script.Parent.DetectionZone
local TweenService = game:GetService("TweenService")
local door = script.Parent.Door -- The Sliding Door Model
local doorSound = script.Parent.DoorSound -- Sound For Door.
local doorLocation = door.PrimaryPart.CFrame -- Initial Door Model Position
local endTweenLocation = script.Parent.EndPos.CFrame -- End Position For The Tween (A part)

local tweenmovement =

local doorOpenTween = TweenService:Create(door,tweenmovement,endTweenLocation)
local doorCloseTween = TweenService:Create(door,tweenmovement,doorLocation)

Sorry if my code is messy…

You cant just tween models you need to tween the primary part of it

1 Like

This is what is incorrect. The variable must be a dictionary not a value.
To fix simply do this

local endTweenLocation = {}
endTweenLocation.CFrame = --CFrame you want to tween to

To tween models, make sure the primary part is anchored and nothing else and make sure all the parts in the model are welded to the primary part.

Then tween the primary part


Models cannot be tweened, tween the primary part instead

1 Like