TweenService won't work to move a model with ProximityPrompt

Hi, i’m trying to move a model with TweenService when a ProximityPrompt is triggered, but im getting the error “TweenService:Create no property named ‘Position’ for object ‘Door’”

I’ve been trying to fix it but anything I try works.

This is my code:

local doorModel = script.Parent.Parent.Parent.Door

function OpenDoor()
	local TweenService = game:GetService("TweenService")  
	local info = TweenInfo.new(
		80,         
		Enum.EasingStyle.Linear,     
		Enum.EasingDirection.InOut,   
		0,                  
		true,               
		0                    
	)

	local property = {           
		Position = Vector3.new(-125.387, 39.637, -435.3), 
	}

	local OpenTween = TweenService:Create(doorModel, info, property) 
	OpenTween:Play()
end

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	print("Open door")
	OpenDoor()
end)

and this is the explorer: (idk if it could help)
image

When I interact with the ProximityPrompt, the print works but the function doesn’t, any thoughts?

Considering the “door” variable is a model, it’s normal for it to not work. Models unfortunately don’t have a .Position property. You should try moving the “Union” child of the door model.

Did you mean WorldPivot.Position?
Sorry, forget this… you’d need a primary part for the model.

1 Like

Heres what you can do.

Unanchor ALL the parts in the model, except for one, this will be your tweening part. I’ll call this part “[M]”.

Now, make a weld constraint that the Part0 property is equal to [M].
Then, set the Part1 property to the unanchored part.

Do this until every single part is welded.

Then, in your script, assign doorModel to [M].
So, it would be like this:

local doorModel = script.Parent.Parent.Parent.Door.MAINPART -- replace MAINPART with [M]

Then, when you play the tween, the parts should be stuck to [M], causing the whole model to move.

YOU CANNOT USE THIS WITH WELDS. USE MOTOR6D OR WELDCONSTRAINTS.

1 Like

I did what you said but only the main part is moving, the others don’t move and stay in the air. The weld constraints are all with the Part0 of the main model (Union) and the parts are unanchored except the Union, maybe I am forgetting something or what?

Nevermind, fixed it by instead of tweening the position of the main object tweening the CFrame of it.

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