TweenService issue

so i have a problem…

i made a doors fanmade game and im still working on the random generation of rooms, when testing the generation (after i got a sideways room) the tween animation of the door opening breaks

robloxapp-20221017-1700096.wmv (2.1 MB)
(Heres a link if u dont want to download)

heres the part of the code which makes the tween

local prox = script.Parent.ProximityPrompt

local tweenS = game:GetService("TweenService")


local open = {
	Position = script.Parent.Position - Vector3.new(4, 0, 0) + Vector3.new(0, 0, 3),
	Orientation = Vector3.new(0,90,0)
}

local ti = TweenInfo.new(
	1
)


local openanim = tweenS:Create(script.Parent,ti, open)

script.Parent.ProximityPrompt.Triggered:Connect(function()
openanim:Play()
end)

any help would be cool, thanks!

Note: This doesnt happen with a normal straight room and no errors appear in output

1 Like

It could be because of the position from script.Parent.Position is different. Try printing the position see if the position before is the same as currently. Or you could copy it and create a part and paste in the position.

image
image
the image is the before and after, it seems its completely setting its position

Try this and see if it works:

script.Parent.ProximityPrompt.Triggered:Connect(function()
	open.Position = script.Parent.Position - Vector3.new(4, 0, 0) + Vector3.new(0, 0, 3)

	tweenS:Create(script.Parent,ti, open):Play()
end)

From what I’m seeing is that you are reusing the same Door and just teleport the door to a different position. Since you already saved the properties of the tween it will just go back to where it was.

Thanks!! you fixed it! the doors actually open and it works!