Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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. )

1 comment

0

Do you get an error running this script?

1 answer

script.Parent.ClickDetector.MouseClick(function()
--which it needs to be 
Connect(function()

I make the same errors all the time lol

2 comments

0

Oh thanks for noticing that but this isn't what I wanted

0

oh ok

This discussion is preserved as it was. New answers, comments, and votes are closed.