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

How do I make a lever script to open a curtain?

Asked by 3 years ago
Edited 3 years ago

For real, I had trouble with this. Can anyone help me make a lever script? I'm not sure how to do it.. It's supposed to open a curtain.

--On Script
script.Parent.ClickDetector.MouseClick:Connect(function()
    Lever1 = script.Parent.Parent.Lever1
    Lever1B = script.Parent
    Blink = script.Parent.Parent.Blink
    Curtain = game.Workspace.Curtain
    Lever1.Orientation = Vector3.new(0, -90, -30)
    Lever1.Position = Vector3.new(160.664, 13.88, 21.692)
    Lever1B.Position = Vector3.new(160.664, 14.223, 21.212)
    Blink.BrickColor = BrickColor.new("Lime green")
    Curtain.Transparency = 0
end)

--Off script
script.Parent.ClickDetector.MouseClick(function()
    Lever1 = script.Parent.Parent.Lever1
    Lever1B = script.Parent
    Blink = script.Parent.Parent.Blink
    Curtain = game.Workspace.Curtain
    Lever1.Orientation = Vector3.new(0, -90, 45)
    Lever1B.Position = Vector3.new(160.664, 12.853, 21.212)
    Blink.BrickColor = BrickColor.new("Really red")
    Curtain.Transparency = 1
end)

Could anyone show me a script using these? (Also, when tested it only activates the on script. )

0
Do you get an error running this script? rabbi99 714 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
script.Parent.ClickDetector.MouseClick(function()
--which it needs to be 
Connect(function()

I make the same errors all the time lol

0
Oh thanks for noticing that but this isn't what I wanted Dragonboy99711 5 — 3y
0
oh ok DevvUnknown 3 — 3y
Ad

Answer this question