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 adapt this Script to a LocalScript?

So I have this script to make a GUI available to only certain people. However, I would like to know how to adapt this to making a LocalScript only enabled for certain people.

Help is greatly appreciated.

Script:

local Table_Of_Names = {"ThrashIsDead","poophead27272","darkslayer741"};
if table.find(Table_Of_Names,game:service'Players'.LocalPlayer.Name)then
    script.Parent.Enabled = true
else 
	script.Parent.Enabled = false
end;

1 comment

0

Is this for when a player joins a game?

1 answer

✓ Accepted answer

It's bad practice to enable and disable scripts like this, instead use if statements.

local Players = game:GetService("Players")
local localplayer = Players.LocalPlayer
local Admins = {['azarth'] = true}
local IsAdmin = Admins[localplayer.Name:lower()]
if IsAdmin then 
	print ("Admin")
end

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