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

How can I make this door accessible only to the group owner and how can I make the door close?

I am currently making a door and only the group owner can make the door open and close the door. Here is what I have so far:

GroupId = 3348123

script.Parent.ClickDetector.MouseClick:connect(function(p)
	if p:IsInGroup(3348123) then
		script.Parent.Transparency = 1
		script.Parent.CanCollide = false
	end
end)

I it so when the group owner clicks the door again to close it Transparency = 0 and CanCollide = true.

Please help me, thank you!

1 answer

✓ Accepted answer

Use GetRankInGroup() instead of IsInGroup since that only looks for people in said group, not looking if they own it or are a fan. Also, below is a toggle open script for ya. Click to open, click to close

script.Parent.ClickDetector.MouseButton1Click:connect(function(p)
    if p:GetRankInGroup(3348123) == 255 then
	if script.Parent.Transparency = 0 then
        script.Parent.Transparency = 1
	script.Parent.CanCollide = false
	else
	script.Parent.Transparency = 0
	script.Parent.CanCollide = true
	end
    else
        -- do nopity nope stuff
    end
end)

1 comment

0

It says MoustButton1Click is not a vaild member of ClickDetector.

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