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

Surfacegui only visible by people on an 'admin list', help please?

Alright, so I was thinking that it would be cool to make a door that slides open when you click on a surfacegui TextButton. This surfacegui would only be visible by people on an admin list else it would remain invisible.

The hierarchy is currently as follows: game.workspace.Part.SurfaceGui.TextButton.LocalScript

The code block below is the contents of the local script, however the code doesn't work. Can anyone shed light on my issue? Thanks!

wait(1)
script.Parent.Active = false

game.Players.PlayerAdded:connect(function(player)
	if player.Name == 'Cubes4Life' then
		print('granted')
		script.Parent.Active = true
	else return false
	end
end)

1 comment

0

Have you tried your code with a Server-Sided script? ['Script' instance].

2 answers

play around with PlayerGui under game.Players.player(admin name) if you want it only visible to admins

I would recommend only cloning the GUI to the player's PlayerGui if they are on your admin list.

local Administrators = {['Player'] = true; ['Player2'] = true;}
 
 local StatusCheck = function(player)
 	return Administrators[player.Name]
 end

The Administrators table above obviously would be the "admin list", and the function following >the table basically scans through the table for the "Player's Name" and returns "true" if found.*

All you'd have to do now if call the StatusCheck function on PlayerAdded and cloning the GUI to their PlayerGui

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