Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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)
0
Have you tried your code with a Server-Sided script? ['Script' instance]. TheeDeathCaster 2368 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

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

Ad
Log in to vote
0
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

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

Answer this question