local allow = (
player:IsInGroup(127081) or
game.CreatorId == player.userId
)
function onClicked(playerWhoClicked)
if allow then
script.Parent.Parent.CDoor.Transparency = 1
script.Parent.Parent.CDoor.CanCollide = false
script.Parent.Parent.CKnob1.Transparency = 1
script.Parent.Parent.CKnob1.CanCollide = false
script.Parent.Parent.CKnob2.Transparency = 1
script.Parent.Parent.CKnob2.CanCollide = false
script.Parent.Parent.ODoor.Transparency = 0
script.Parent.Parent.ODoor.CanCollide = true
script.Parent.Parent.OKnob1.Transparency = 0
script.Parent.Parent.OKnob1.CanCollide = true
script.Parent.Parent.OKnob2.Transparency = 0
script.Parent.Parent.OKnob2.CanCollide = true
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
This is a door script I made. Without the group detector (allow), it works. When I remove allow, it doesn't work. Why?

8 comments
Yes, I am in the group.
you need to put a wait on line 14
I don't think that's the issue, because if you look at the parts, I have CDoor and ODoor, I don't want a delay between opening them.
I would suggest having the script print(allow) so that you can be sure that allow is printing what you want it to print. Is your script outputting any errors?
The term "player" doesn't appear to be defined. How would I do that?
You need to check for the allow condition every click, which means that you will need to set the allow variable inside the event, and replace player by playerWhoClicked.
@lucas200206 That worked. Can you write that as an answer, so I can mark it as correct?
You should probably learn the basics of Lua before you script things.