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

Why isn't this button door script working? [closed]

Asked by 10 years ago

I have a door and two buttons. One button is supposed to make the door transparent, one button is supposed to return it back to its opaque state. Whenever I click one of the buttons, nothing pops up in the output.

Close button:

function onClicked()

Script.Parent.Parent.Door.Transparency = 0
Script.Parent.Parent.Door.CanCollide = true

end

Script.Parent.ClickDetector.MouseClick:connect(onClicked)`

Open button:

function onClicked()

Script.Parent.Parent.Door.Transparency = 1
Script.Parent.Parent.Door.CanCollide = false

end

Script.Parent.ClickDetector.MouseClick:connect(onClicked)

Setup: http://i.imgur.com/0Cy2ROJ.png

Locked by Shawnyg, iluvmaths1123, TofuBytes, and M39a9am3R

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
2
Answered by 10 years ago

The "s" in "Script.Parent" is supposed to be lowercased

function onClicked()

script.Parent.Parent.Door.Transparency = 0
script.Parent.Parent.Door.CanCollide = true

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Ad