Simple Chest animation seems very odd

I want to have a simple opening and closing chest animation and i cannot have the chest anchored in any way. i came with this very simple code but the result is not what i wanted at all

local Down = script.Parent.Parent
local Up = script.Parent.Parent.Parent.Up
local proximity = Up.Union.ProximityPrompt

local TweenService = game:GetService("TweenService")

local function Open() 
	local TInfo = TweenInfo.new(1)
	local TGoal = {}
	local CGoal = {}
	TGoal.CFrame = Up.PrimaryPart.CFrame * CFrame.Angles(0, 0, math.rad(70))
	CGoal.CFrame = Up.PrimaryPart.CFrame * CFrame.Angles(0, 0, 0)
		
	local Open = TweenService:Create(Up.PrimaryPart,TInfo,TGoal)
	local Close = TweenService:Create(Up.PrimaryPart,TInfo,CGoal)

	
	Up.PrimaryPart.Weld.Enabled = false
	Open:Play()
	local weld = coroutine.create(function()
		while wait(0.01) do
			local weld = Instance.new("Weld")
			weld.Parent = Up.PrimaryPart
			weld.Part0 = weld.Parent
			weld.Part1 = Down.PrimaryPart
			weld:Destroy()
		end
	end)
	
	Open.Completed:Connect(function()
		Close:Play()
		Close.Completed:Connect(function() 	Up.PrimaryPart.Weld.Enabled = true end)
		coroutine.close(weld)
		print("E")
	end)

end

proximity.Triggered:Connect(function(player)
	Open()
	print(player)
	proximity.Enabled = false

	task.delay(3, function()
		
		proximity.Enabled = true
	end)
end)

here is a video on whats happening sorry for the HORRENDUS quaility i used robloxes built in recording system
robloxapp-20200910-2000336.wmv (8.4 MB)
sorry idk how to turn it into mp4

here is the explorer:

I am just pretty sure there is something wrong with the tween because thats where the animation is as well

i would recommend using moon animator unless you dont have it. Less work needed and you can have more fluid animations as it uses different EasingStyles

1 Like

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