Is there a way to have a script activate other scripts?

Hello!
This is kinda an extension of my last thread in a way, but I’m trying to make it so that when I open my door, (single door works just fine) in the case of a double door, clicking either door will open both doors. right now I have it opening one door at a time.

my single door uses this code


local door = script.Parent
local doorHinge = door.PrimaryPart
local doorOpen = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)

local doorCFrame = TweenService:Create(doorHinge, doorOpen, {
	CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(-100),0)
})

local doorCFrameClosed = TweenService:Create(doorHinge, doorOpen, {
	CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(0), 0)
})

local ClickDetection = door.ClickDetector

ClickDetection.MouseClick:Connect(function()
	ClickDetection.MaxActivationDistance = 0
	doorCFrame:Play()
	door.Open:Play()
	wait(3)
	doorCFrameClosed:Play()
	wait(0.5)
	door.Close:Play()
	ClickDetection.MaxActivationDistance = 24
end)
1 Like

You could have a script listen for the ClickDetector’s event and have the code open both doors. You’d create 2 separate CFrames for both doors.

You can to use bindable events. For more details, you could check this link.

1 Like