BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 15 May 2014 12:20 PM |
playerList = {"Player1","Player2"}
script.Parent.Touched:connect(function(hit) for i = 1, #playerList do if hit.Parent.Name ~= playerList[i] then print(hit.Parent.Name.."'s Name is not equal to list of Admins") h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then h:TakeDamage(1) end end end end end)
Okay, with this script, if I were to touch the brick, it shouldn't hurt me.... BUT IT DOES. EVEN THOUGH MY NAME IS PLAYER1 IN STUDIO!
What the heck is going on here? |
|
|
| Report Abuse |
|
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 15 May 2014 12:38 PM |
Currently, you're iterating through the table "asking" if the hit parent's name is equal to the current iteration. So, whilst your name may match "Player1" it doesn't match "Player2", which causes it to damage you.
|
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 15 May 2014 12:40 PM |
| I see. Thanks for the tip, I'll see what I can do. |
|
|
| Report Abuse |
|
|