How do I rotate a part around an attachment

So this is a door


And I want it to rotate around(With tweenservice) around the attachment(The green thing, if you look close you can see it)

when its rotating it should look like this,

How can I do this? Thanks!

I would suggest just making a part in that attachment position and setting it as primarypart of the door, then you just rotate the primarypart using tweens which should do exactly what you described

1 Like

Ok this rotates the thing but it dont rotate anything welded to it, any work arounds?

Try putting all the parts that need to move in the same model

also i’d appreciate if you could show the code, could be an issue in how you’re tweening it

Code :3

module.functions['DoorActivate'] = function(doorModel:Model) -- make doors work
	-- items
	local door:BasePart = doorModel:FindFirstChild('Door')
	local DoorFrame:BasePart = doorModel:FindFirstChild('DoorFrame')
	local hinge:BasePart = door:FindFirstChild('Hinge')
	
	-- trigger
	local trigger:BasePart = doorModel:FindFirstChild('Trigger')
	local prompt:ProximityPrompt = trigger:FindFirstChildOfClass('ProximityPrompt')
	
	-- actual code
	
	prompt.Triggered:Connect(function()
		print('Open door')
		trigger:Destroy()
		
		local tween = tweenservice:Create(hinge,doorInfo,{Orientation = Vector3.new(0,hinge.Orientation.Y - 90,0)})
		tween:Play()
	end)
end

Screenshot 2023-11-12 203746
And uh they are in the same model

this should work fine i think,

module.functions['DoorActivate'] = function(doorModel:Model) -- make doors work
	-- items
	local door:BasePart = doorModel:FindFirstChild('Door')
	local DoorFrame:BasePart = doorModel:FindFirstChild('DoorFrame')
	local hinge:BasePart = door:FindFirstChild('Hinge')
        doorModel.PrimaryPart = hinge
	
	-- trigger
	local trigger:BasePart = doorModel:FindFirstChild('Trigger')
	local prompt:ProximityPrompt = trigger:FindFirstChildOfClass('ProximityPrompt')
	
	-- actual code
	
	prompt.Triggered:Connect(function()
		print('Open door')
		trigger:Destroy()
		
		local tween = tweenservice:Create(hinge,doorInfo,{CFrame = hinge.CFrame * CFrame.Angles(0,math.rad(90),0)})
		tween:Play()
	end)
end
1 Like

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