if game.Players.LocalPlayer.Name == "username 1" then
How would I add more usernames?
Okay, your best bet is to use an array storing all the usernames. That way you don't have to keep using 'or' since it's an operator.
I am not entirely sure why you are using a LocalScript for your checks since this can be abused by exploiters, but it's your personal preference I guess.
Players = game:GetService('Players') Player = Players.LocalPlayer local usernameList = {'bob123', 'username', 'robloxadminguy123'} -- Store all the usernames here. function checkUsername(Player) local nameString = Player.Name for _,v in pairs(usernameList) do -- loop through the table if string.lower(v) == string.lower(nameString) then -- use string.lower for cap sensitivity return true -- if username found, return true end end return false -- otherwise no username found, false end if checkUsername(Player) then -- rest of code here end -- end the if statement
A breakdown of the code would be, the array stores the data and the function loops through that data to check if a string matches the data, if it does then it'll pass the if statement.
Use the **or **statement
ex:
if game.Players.LocalPlayer.Name == "username 1" or "username 2" or "username 3" then
Closed as Not Constructive by hiimgoodpack and DeceptiveCaster
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?