Teaching a 9 y/o how to script and I am having trouble atm :P Seems right to me. I am making a door where only certain people can go through it. I can go through it no matter what though. It does not kill me either.
Admins = {"Player", "PreyStar"} script.Parent.Touched:connect(function(hit) if hit.Parent.Name == (Admins[1]) or (Admins[2]) or (Admins[3]) or (Admins[4]) then script.Parent.CanCollide = false wait(1) script.Parent.CanCollide = true print (hit.Parent.Name) end if hit.Parent.Name ~= (Admins[1]) or (Admins[2]) or (Admins[3]) or (Admins[4]) then hit.Parent:BreakJoints() end end)
or
separates two distinct conditions.
if condition1 or condition2
condition1
and condition2
are in no way related!
if hit.Parent.Name == (Admins[1]) or (Admins[2])
The left side of or
and the right side of or
aren't connected in any way, shape, or form!
And equivalent way to write your code would be
if hit.Parent.Name == (Admins[1]) or (Admins[2]) == true
Since strings are considered to be true
by Lua, the condition will always pass.
All you need to do is write your conditions separately.
if hit.Parent.Name == (Admins[1]) or hit.Parent.Name == (Admins[2])
Although admittedly using dictionaries would make your code shorter.