You're comparing the name of the player to a table.
Line 02 is the table and on line 05 you access the Name property which gives you a string.
You need to index the table to read the value of each element.
You can do this with a for-loop to linearly search for a value in the 'names' table:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local names = {"Player1", "14dark14"}
local foundName = false
for _, name in pairs(names) do
if name == player.Name then
foundName = true
break
end
end
if foundName then
script.Parent.Enabled = true
else
script.Parent:Destroy()
end
I recommend that you learn more about the basics of Lua. Specifically, loops and tables as these are concepts that will help you become a better programmer:
Let me know if you don't understand anything or if I left something out.
3 comments
Yes this would work, but it would get messy if there were many names in the table
You could use a for loop and loop through the names in the table.
I'm bad at for loops so no.