|
| 10 Apr 2013 07:10 AM |
For example:
if not player.Name == "1cooldude361" and player.Name == "untamedangel44" then
Would having the not after the if make it so the player's name can't be 1cooldude361 OR untamedangel44, or will it only make it so the player's name can't be 1cooldude361? To make it so it can't be either one, would it be:
if not player.Name == "1cooldude361" and not player.Name == "untamedangel44" then
?
MUST. RUIN. CHILDHOOD. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2013 07:13 AM |
Well, to answer your question, no. It only affects the data immediately following it.
However, I think you should be able to answer these sort of questions yourself, in the future. You can experiment with stuff like:
print(not "cooldude") print(not "cooldude == "cooldude")
and so on... |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2013 07:16 AM |
Yeah, I know. There was this line in my script, and so I was confused as to how it wasn't working. Sadly, I already had the not's after every and, so this didn't help me with my script at all. Luckily, it's new info that I can be sure on. So, thanks.
MUST. RUIN. CHILDHOOD. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2013 07:23 AM |
Could you guys fix this little part of my script, too?
b = game.Workspace:GetChildren() for i = 1, #b do if b[i].ClassName == "Model" and b[i].Name ~= "FFAMap" and not b[i]:findFirstChild("Humanoid") then --This if statement is the error line. Nothing appears in the output, but it stops putting messages up when it gets to this line (I removed the insertion of the messages so the script was smaller for you guys). Any idea what's wrong with it?
MUST. RUIN. CHILDHOOD. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2013 07:34 AM |
| Before the if line, print the classname, name and that third condition in the if statement, so you can know what is going on. |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 10 Apr 2013 07:41 AM |
It's more efficient and easier to read to use a generic for:
for _, v in ipairs(Workspace:GetChildren()) do if v:IsA("Model") and v.Name ~= "FFAMap" and not v:FindFirstChild("Humanoid") then --stuff and things end end |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2013 07:59 AM |
| More efficient is not really valid. 0.05 seconds different per 5000 isn't a lot. |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 10 Apr 2013 12:35 PM |
| True, the readability is there, and there's less to type, so less to mess p. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2013 12:40 PM |
| Good points. I prefer the second method too. |
|
|
| Report Abuse |
|
|