i like to know about double script in one script (2 script in one board(2x1)) example: i want to make a button door also a light above it goes on when the door open can somebody help me with this one.
✓ ANSWER ACCEPTED
how to make double script in one board/layer ?
1 answer
✓ Accepted answer
You have three parts in Workspace: The Door; The Button, and the Light Part.
In the button, you are going to insert a server script:
--Variables
local Button = script.Parent
local Light = game.Workspace.Light
local ClickDetector = script.Parent:WaitForChild('ClickDetector')
local Door = game.Workspace.Door
--Code
ClickDetector.MouseClick:Connect(function(plr) --when player clicked button
--To open door
Door.Transparency = 0.5
Door.CanCollide = false
Light.PointLight.Enabled = true
--If you want to close the door
wait(2)
Door.Transparency = 0
Door.CanCollide = true
Light.PointLight.Enabled = false
end)
That is it.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
when ur done with making the button door drop a line after the last end and start on the light