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

Why won't this ClickDetector script work?

Asked by 9 years ago

THIS WAS ALREADY ANSWERED BY BLUETASLEM IN A COMMENT. PLEASE STOP ANSWERING.

function open()
    local DoorWhole = script.Parent.Parent.Parent.Parent
    DoorWhole.DoorOpened.Handle1.Transparency = 0
    DoorWhole.DoorOpened.Handle2.Transparency = 0
    DoorWhole.DoorOpened.Part.Transparency = 0
    DoorWhole.DoorOpened.Handle1.CanCollide = true
    DoorWhole.DoorOpened.Handle2.CanCollide = true
    DoorWhole.DoorOpened.Part.CanCollide = true
end

script.Parent.MouseClick:connect(open)

^ That's the script. *Keep in mind that I'm working with a ClickDetector. Please try your best to answer this for me ASAP. The sooner, the better. Thank you!

1
Is there any error? Is this a Script or a LocalScript? BlueTaslem 18071 — 9y
0
This is a regular script, no errors appear in Output. SchonATL 15 — 9y
1
What isn't working exactly? BlueTaslem 18071 — 9y
0
The entire thing. The door doesn't show up and I can walk through where it should go. SchonATL 15 — 9y
View all comments (2 more)
1
Have you enabled "FilteringEnabled"? GoldenPhysics 474 — 9y
0
Is the script inside the clickdetector? Grenaderade 525 — 9y

3 answers

Log in to vote
0
Answered by 9 years ago

I think the reason the script doesn't work is that there is something missing in the last line that calls the script to function. Assuming that this script is in the clickable part, the line should be script.Parent.ClickDetector.MouseClick:connect(open).

function open()
    local DoorWhole = script.Parent.Parent.Parent.Parent
    DoorWhole.DoorOpened.Handle1.Transparency = 0
    DoorWhole.DoorOpened.Handle2.Transparency = 0
    DoorWhole.DoorOpened.Part.Transparency = 0
    DoorWhole.DoorOpened.Handle1.CanCollide = true
    DoorWhole.DoorOpened.Handle2.CanCollide = true
    DoorWhole.DoorOpened.Part.CanCollide = true
end

script.Parent.ClickDetector.MouseClick:connect(open)
0
The script is actually in the ClickDetector, thanks for trying anyways :) SchonATL 15 — 9y
0
Darn. Could you show us how your objects are structured? Maybe that will give us a clue about what's wrong with the script. IcyArticunoX 355 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

function open() local DoorWhole = script.Parent.Parent.Parent.Parent DoorWhole.DoorOpened.Handle1.Transparency = 0 DoorWhole.DoorOpened.Handle2.Transparency = 0 DoorWhole.DoorOpened.Part.Transparency = 0 DoorWhole.DoorOpened.Handle1.CanCollide = true DoorWhole.DoorOpened.Handle2.CanCollide = true DoorWhole.DoorOpened.Part.CanCollide = true end script.Parent.ClickDetector.MouseClick:connect(open)

at last line you need "script.Parent.ClickDetector.MouseClick:connect(open)" you forgot to put ClickDetector in the final line.

Log in to vote
0
Answered by 9 years ago

Guys, BlueTaslem answered this in a comment. It does not show as answered because I can't accept an answer if it's in the form of a comment.

Answer this question