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

Is there a way to have an VIP/Owner only ClickDetector?

Could you maybe get the player from the Click and check the name? I am unsure of this... Here is what I tried. I tried to use click like you would use a hit on the touched event.

function click(click)
	if click.Parent.Name == "doctorbenny2011" then 
		print("Test Passed")
	else
		print("Test Failed")
	end
end

script.Parent.ClickDetector.MouseClick:connect(click)

1 answer

✓ Accepted answer

Should be:

function click(click)
    if click.Name == "Player" or click.Name=="doctorbenny2011"  then -- click is the player that clicks the `ClickDetector`
        print("Test Passed") -- successfully prints `Test Passed`
    else
        print("Test Failed")
    end
end

script.Parent.ClickDetector.MouseClick:connect(click)

click gains access to the player, if we place click.Parent that will lead us to Playerscontainer.

2 comments

0

WOW! Thanks alot I didn't think this would be possible! :)

0

You should make an edit that shows how to do it with arrays aswell, since it is useful for multiple names

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