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

Why won't this ClickDetector script work?

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!

6 comments

1

Is there any error? Is this a Script or a LocalScript?

0

This is a regular script, no errors appear in Output.

1

What isn't working exactly?

0

The entire thing. The door doesn't show up and I can walk through where it should go.

1

Have you enabled "FilteringEnabled"?

0

Is the script inside the clickdetector?

3 answers

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)

2 comments

0

The script is actually in the ClickDetector, thanks for trying anyways :)

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.


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.

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.

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