So I have a trail in my game made only for admins but I would like to not have to make like 10 local scripts with different names in it for every admin Is there any way I could add a variable that is just all of the admins’ names in one script.
Code
wantedtrail = nil
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.Name “arkboys99” then
wantedtrail = “AdminTrail”
workspace.Events.Trail:FireServer(wantedtrail)
end
end)
windtrail = nil
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.Name == “arkboys99” then
wantedtrail = “AdminTrail”
workspace.Events.Trail:FireServer(wantedtrail)
end
end)
local admins = {
'king_B99';
'coolAdmin';
'placeholder text lol';
}
local wantedtrail = nil
script.Parent.MouseButton1Click:Connect(function()
if table.find(admins, game:GetService('Players').LocalPlayer.Name) then
wantedtrail = “AdminTrail”
workspace.Events.Trail:FireServer(wantedtrail)
end
end)
I also recommend not giving the client access to your admin panel but that’s up to you.
Yeah, the most secure way would be to use a server script that checks the user ID but it’s up to the op. You could fire the event on the client but I highly recommend doing all security checks on the server.