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

How can I adapt this Script to a LocalScript?

Asked by 4 years ago

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;
0
Is this for when a player joins a game? 123nabilben123 499 — 4y

1 answer

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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
Ad

Answer this question