Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to make double script in one board/layer ?

Asked by 4 years ago

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.

0
when ur done with making the button door drop a line after the last end and start on the light Gameplayer365247v2 1055 — 4y

1 answer

Log in to vote
0
Answered by
Lazarix9 245 Moderation Voter
4 years ago

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.

Ad

Answer this question