[Solved] Scripting Doors [Issuse]

I’m trying to learn to be a scripter I am just confused about how to sync two different buttons to this script that worked perfectly until I attempted to adjust for one of my doors.

I am hoping that there’s a line of script that I am unaware of that can sync two buttons into one.

As you can see this is one of my attempts to try to link the buttons together.

local PowerMain = script.Parent.PowerMain.HingeConstraint
local PowerA = script.Parent.PowerA.HingeConstraint
open = false
script.Parent:WaitForChild(‘ClickDetector’)elseif
script.Parent.Script:WaitForChild(‘ClickDetector’) .MouseClick:connect(function()
if open == false then
script.Parent.ClickDetector.MaxActivationDistance = 0

	PowerA.TargetAngle = -100
	wait(4)
	PowerMain.TargetAngle = 100
	
	open = true
	
	wait(5)
	script.Parent.ClickDetector.MaxActivationDistance = 10
open = true
elseif open == true then
	script.Parent.ClickDetector.MaxActivationDistance = 0
    
	PowerMain.TargetAngle = 0
	wait(3)
	PowerA.TargetAngle = 0

	wait(6)
	script.Parent.ClickDetector.MaxActivationDistance = 10
open = false
end

end)

What you could do in order to sync to buttons is use a BoolValue Instance, which can store a Boolean which other scripts should be able to access.

Neaver heard of one of them, I will look into it. Thank you.

1 Like