My first click to open the door on this code works perfectly fine but on the second tween/click to close the door nothing happens. Any help with this script would be greatly appreciated.
local TweenService = game:GetService("TweenService")
local door = workspace.Door
local doorRoot = door.PrimaryPart -- important
local DoorSwingInfo = TweenInfo.new()
local DoorSwingTween = TweenService:Create(doorRoot, DoorSwingInfo, {
CFrame = doorRoot.CFrame * CFrame.Angles(0, math.rad(-105), 0)
})
local DoorSwingCloseTween = TweenService:Create(doorRoot, DoorSwingInfo, {
CFrame = doorRoot.CFrame * CFrame.Angles(0, math.rad(105), 0)
})
if script.Parent.IsOpen.Value == false then
script.Parent.ModernDoorHandleBack.ClickDetector.MouseClick:Connect(function()
DoorSwingTween:Play()
script.Parent.IsOpen.Value = true
end)
script.Parent.ModernDoorHandleFront.ClickDetector.MouseClick:Connect(function()
DoorSwingTween:Play()
script.Parent.IsOpen.Value = true
end)
if script.Parent.IsOpen.Value == true then
script.Parent.ModernDoorHandleBack.ClickDetector.MouseClick:Connect(function()
DoorSwingCloseTween:Play()
script.Parent.IsOpen.Value = false
end)
script.Parent.ModernDoorHandleFront.ClickDetector.MouseClick:Connect(function()
DoorSwingCloseTween:Play()
script.Parent.IsOpen.Value = true
end)
end
end
On the fourth function you whrote with mouse detector function on the ModernDoorHandleFront i think that the code bellow it with the script.Parent.IsOpen.Value = true
should be script.Parent.IsOpen.Value = false
To embed you need a recording software. Roblox only records in wmv which sucks for us cos it is terrible quality plus it doesn’t embed. Get obs and you can record much better quality.
If the door is already closed then you don’t need to transform / multiply the CFrame.
Small note: I would advise using a ProximityPrompt over ClickDetector it’s much more user friendly for computer and even modal devices too,