Hello everyone, I am making a door opening script and to make the door open correctly i made an invisible part double the size of the actual door so when the invisible part is rotated the door rotates along the hinge of the door. But when I use TweenService to rotate the invisible part, only the invisible part moves and the actual door doesnt move along with it. When I use the Rotate tool, the children move with it however.
That’s how it should be. How can I fix this? Create a part for your door that will spin. Honestly, I do not know its name in English(I will name it Hinge). Anchor Hinge and UnAnchor the rest of the model. Now use WeldConstarint where Part0 is a Hinge and Part1 is another element. Attach all the parts in this way… rewrite the script for scrolling the door so that it rotate exactly the Hinge
What do you mean rewrite the script for scrolling the door?
Sorry, the translator is messing up. I mean door opening script
I made a weldconstraint for the door and i put part 0 as the door and part 1 as the hinge of the door, but the door just rotates like this:

Here’s the script:
local collectionService = game:GetService("CollectionService")
local tweenService = game:GetService("TweenService")
local goal = {}
goal.Orientation = Vector3.new(0, 0, 0)
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)
for i, part in collectionService:GetTagged("OpenableDoor") do
local doorHandle = part:WaitForChild("DoorHandle")
local clickDetector = doorHandle:WaitForChild("ClickDetector")
clickDetector.MouseClick:Connect(function(plr)
local tween = tweenService:Create(part, tweenInfo, goal)
tween:Play()
end)
end
on the contrary, the part0 is a Hinge
Yes sorry I did that (charlimit)
local collectionService = game:GetService("CollectionService")
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false)
for index, doorModel in collectionService:GetTagged("OpenableDoor") do
local doorHandle = doorModel:WaitForChild("DoorHandle")
local clickDetector = doorHandle:WaitForChild("ClickDetector")
local hinge = doorModel:WaitForChild("Hinge")
local opened = false
clickDetector.MouseClick:Connect(function(plr)
local targetCFrame = hinge.CFrame * CFrame.Angles(0, math.rad(opened and -90 or 90), 0)
local tween = tweenService:Create(hinge, tweenInfo, {CFrame = targetCFrame})
tween:Play()
opened = not opened
end)
end
try smthing like this
[[I would give you my own door system that tweaks on the client, but syncs the state with the server, but it will be difficult to figure out how to add it.]]
As you can see from the picture below it almost works but the door’s edge doesn’t connect with the hinge (the selected object outlined in blue)

can i see your client side script?
so make your Hinge for the entire doorway in height and length, and move your door closer to the Hinge. so that the door touches the edge with its part, and this artifact will disappear.
By the way, this is how the doors are implemented in my game.
-- module
local DoorClass = {}
function DoorClass.new (model: Model)
assert(model:IsA("Model"), "Not a Model")
assert(model.PrimaryPart, "No primary for model ".. model.Name)
model:SetAttribute("Opened", false)
local clickDetector = Instance.new("ClickDetector")
clickDetector.MaxActivationDistance = 9
clickDetector.Parent = model.Door
clickDetector.MouseClick:Connect(function(player)
local isOpened = model:GetAttribute("Opened")
model:SetAttribute("Opened", not isOpened)
task.wait(0.5)
model.PrimaryPart.CFrame = model.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(isOpened and 90 or -90), 0)
end)
end
return DoorClass
--server
local CollectionService = game:GetService("CollectionService")
local ServerScriptService = game:GetService("ServerScriptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DoorClass = require(ServerScriptService.Gameplay.Classes.DoorClass)
local Const = require(ReplicatedStorage.Constants)
local ElapsedTime = require(ReplicatedStorage.Utils.GetElapsedTime)
for _, door in CollectionService:GetTagged(Const.DOOR_TAG) do
DoorClass.new(door)
end
CollectionService:GetInstanceAddedSignal(Const.DOOR_TAG):Connect(function(door)
DoorClass.new(door)
end)
local formatted_time = string.format("[%#.3f ms]: DoorController", ElapsedTime.getElapsedTimeMilliseconds())
print(formatted_time)
--client
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Const = require(ReplicatedStorage.Constants)
local TWEEN_TIME = Const.DOOR_TWEEN_SPEED
local doorSound = game:GetService("SoundService").Sounds.Door
local tweenInfo = TweenInfo.new(TWEEN_TIME, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local function tweenDoor(door, targetRotation)
local primaryPart = door.PrimaryPart
local initialCFrame = primaryPart:GetAttribute("InitialCFrame")
local targetCFrame = initialCFrame * CFrame.Angles(0, math.rad(targetRotation), 0)
local tween = TweenService:Create(primaryPart, tweenInfo, { CFrame = targetCFrame })
tween:Play()
doorSound:Play()
end
for _, door in CollectionService:GetTagged(Const.DOOR_TAG) do
local primaryPart = door.PrimaryPart or door:WaitForChild("Hinge")
primaryPart:SetAttribute("InitialCFrame", primaryPart.CFrame)
door:GetAttributeChangedSignal("Opened"):Connect(function()
local isOpened = door:GetAttribute("Opened")
if isOpened then
tweenDoor(door, -90)
else
tweenDoor(door, 0)
end
end)
end
CollectionService:GetInstanceAddedSignal(Const.DOOR_TAG):Connect(function(door)
local primaryPart = door.PrimaryPart or door:WaitForChild("Hinge")
primaryPart:SetAttribute("InitialCFrame", primaryPart.CFrame)
door:GetAttributeChangedSignal("Opened"):Connect(function()
local isOpened = door:GetAttribute("Opened")
if isOpened then
tweenDoor(door, -90)
else
tweenDoor(door, 0)
end
end)
end)
so:
By the way, they work without remoteEvents.
For some reason it wasn’t working because it rotated way too much, but then i realised it was because i did 0,90,0 instead of 0,math.rad(90),0 ![]()
I’m still doing some tests to make sure it works properly
