Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can you make an on-click swinging door?

1 answer

Yes, it is possible , there are multiple ways you could do this. I would recommend Motor6D, it is like a weld but can change its angles in a motor like fashion so the welded part can move I think it would look something like this: Let's say there is a click detector in the door

local DMotor = Instance.new("Motor6D")
local Part1 = workspace.DoorHinge
-- Part1 would be like a door hinge for the door or something
local Part2 = workspace.Door
DMotor.Part0 = Part1
DMotor.Part1 = Part2
DMotor.CFrame = Part2.CFrame:inverse() * Part1.CFrame
DMotor.Parent = Part2
DMotor.MaxVelocity = 50
local IsOpen = false
function OnClick(player)
--the player who clicked might matter to you but I'm not going to use it
if IsOpen then
DMotor.DesiredAngle = 0
else
DMotor.DesiredAngle = 60
end
end

You might want to adjust the angles I should probably stop giving out free scripts

  • Wafflecow321

This discussion is preserved as it was. New answers, comments, and votes are closed.