Animated Door help

Hello!

I am trying to create a safety bar for a funfair ride i am creating (the ride itself is complete).

However i am currently having trouble with how to actually setup the safety (door) the door works when the hinge is anchored but because the funfair ride has to be fully unanchored the hinge doesn’t work at all

Does anybody know a way i can get around having to have the hinge part anchored down?

Code i am using

local on = script.Parent.On
local door = script.Parent.Parent
local doorRoot = door.PrimaryPart

local doorswinginfo = TweenInfo.new(0.7)

local DoorSwingTween = TweenService:Create(doorRoot, doorswinginfo, {
	CFrame = doorRoot.CFrame * CFrame.Angles(0, math.rad(58), 0)
})

local DoorCloseTween = TweenService:Create(doorRoot, doorswinginfo, {
	CFrame = doorRoot.CFrame * CFrame.Angles(0, math.rad(0), 0)
})


script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
	if on.Value == false then
		on.Value = true
		DoorSwingTween:Play()
		script.Parent.Sound:Play()
	elseif on.Value == true then
		on.Value = false
		DoorCloseTween:Play()
		script.Parent.Sound2:Play()
	end
end)

I have also setup an rbxm file with two versions of the safety bar/door one with the anchored/working version and another one which is unachored and not yet workin

(the unacnhored one is the one i need working)
Everything is included in the download file.

Appreciate any help and apologies if that all sounds REALLY confusing.

RLXDevSafetyBars.rbxm (91.0 KB)

Hinges are deprecated. Try animating using tweens and scripts.

Have you even read the script?

Fixed it, I added a pivot point, removed the hinges, unanchored all of the parts, and welded the parts to PivotPoint:

RLXDevSafetyBars_Fixed.rbxm (90.1 KB)
https://i.gyazo.com/75df5ce9853ab97fc4cdcd92217dd2bc.mp4