So this is a simple script where a player steps on a brick and it checks to see if it is an admin or not. If the player is not an admin, they die. If the player is, the brick turns yellow. I wrote the script corresponding to a scripting tutorial: https://www.youtube.com/watch?v=jQ0iClyt_zA&t=312s
Here is the script with the bindable function and list of admins:
admins = {"crystalclay", "Player1", "Player2", "John", "Bob"}
script.GetList.OnInvoke = function(name)
isAdmin = false
for i,v in pairs (admins) do
if name == v then
isAdmin = true
break
end
end
if isAdmin == true then
return true
else
return false
end
end
The problem with this script is that, on line 4, the first "isAdmin" is underlined in blue.
Here is the script for the part:
script.Parent.Touched:connect(function(hit)
humanoid = hit.Parent:FindFirstChild("Humanoid") -- The first "humanoid" is underlined in blue
if humanoid then
playerName = hit.Parent.Name -- "playerName" is underlined in blue
isAdmin = game.Workspace.ListoAdmins.GetList:Invoke(playerName) -- "isAdmin" is underlined in blue
if isAdmin == true then
Part.BrickColor = BrickColor.new("Bright Yellow") --"Part" is underlined in blue
else
humanoid.Health = 0
end
end
end)
I do not understand why there are blue underlines as I double checked and typed the script exactly as Peaspod did in this video.
Here is the error message I'm getting: 21:51:31.537 - Workspace.Part.Script:7: attempt to index global 'Part' (a nil value)

2 comments
EDIT: THE SCRIPT WORKS, AFTER I CHANGED PART TO SCRIPT.PARENT. The script worked how it should, but the part turned gray instead of yellow. And the blue underlines are still there. Otherwise, it works fine! However, it would be great if somebody could explain to me why this happened so.
for that first isAdmin, change it to: local isAdmin = false