generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: using 'not'

Previous Thread :: Next Thread 
skate1011 is not online. skate1011
Joined: 13 Mar 2010
Total Posts: 688
23 Oct 2012 07:30 PM
So I was wondering if this was right
nollie.Value = not nollie.Value

wiki.roblox.com
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
23 Oct 2012 07:32 PM
I think so.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
23 Oct 2012 07:33 PM
No...
The not operator is used to check if something is opposite. Like heres an example.


Value = false
if not Value == true then
print 'yolo'
end

--> yolo


~thedestroyer115, check out my sets!~
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 Oct 2012 07:34 PM
@OP
You can do that only with bool values

a = false

a = not a
print(a)
>true

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
skate1011 is not online. skate1011
Joined: 13 Mar 2010
Total Posts: 688
23 Oct 2012 07:35 PM
It is a bool value.

wiki.roblox.com
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
23 Oct 2012 07:35 PM
This is very useful if checking for an object exists. Lets say I wanted to parent a part to workspace if yolo didn't exist.


if not game.Workspace:findFirstChild("yolo") then
Instance.new("Part", game.Workspace)
end


~thedestroyer115, check out my sets!~
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
23 Oct 2012 07:35 PM
This is a sample from my current project

function setTeam()
local bool = false
for i,v in pairs(game.Players:GetPlayers()) do
if bool then
v.TeamColor = game.Teams[tOne].TeamColor
bool = not bool
else
v.TeamColor = game.Teams[tTwo].TeamColor
bool = not bool
end
end
end

Pretty sure you can use that.
Report Abuse
skate1011 is not online. skate1011
Joined: 13 Mar 2010
Total Posts: 688
23 Oct 2012 07:36 PM
"OP" please get out. It was a simple question.

wiki.roblox.com
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 Oct 2012 07:39 PM
What?

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
23 Oct 2012 07:40 PM
^
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
23 Oct 2012 07:46 PM
The not operator acts like a negative sign, except with any value. When you use the not operator, you "negate the truth" of that value. In Lua, truth values are as follows:

false - nil, false
true - everything else

Which means:


not "String" --> false
not false --> true
not nil --> true
not 0 --> false
not 0==1 --> not false --> true


Basically, when you "negate the truth" of a value, you simple take its boolean counterpart and use the opposite.

function toBoolean(Value)
return not not Value
end


This works because:


toBoolean("string") --> not not "string" --> not false --> true
toBoolean(nil) --> not not nil --> not true --> false
Report Abuse
skate1011 is not online. skate1011
Joined: 13 Mar 2010
Total Posts: 688
23 Oct 2012 07:50 PM
Do you even know what "OP" means? Because if you don't, then don't use it.

wiki.roblox.com
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 Oct 2012 08:17 PM
OP means Original Poster, aka the person who created the thread.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
23 Oct 2012 08:20 PM
skate, please tell me who said that...

http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
23 Oct 2012 08:21 PM
Stop stalking me.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
23 Oct 2012 08:27 PM
I don't think the OP is stalking you, Chop, but I know for a fact you're stalking me AGAIN. Please go away, little kid.

http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
23 Oct 2012 08:28 PM
Hmm, your boyfriend is like 10, don't talk about little kids.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
23 Oct 2012 08:29 PM
Just stop. I've answered the question. Move on.

@Chop
That was UNCALLED for.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
23 Oct 2012 08:30 PM
Fine, I'll stop.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
23 Oct 2012 08:32 PM
Chop, that was a bit uncalled for, either way, you're statement in 'invalid'. There's no proof I like guys. If you're referring to mamaguy, he's just a friend, try to get some. I mean you're just a raging tyke. You say other people's statements are invalid, but yours are invalid. Get real and stop being a hypocrite.

http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information.
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
23 Oct 2012 08:32 PM
@Chop,
This just proves your stupidity, immaturity, and lack of memory
11,
12 in two months
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
23 Oct 2012 08:37 PM
I said STOP.
Knock it off.

Before I call Reese and tell her I want to be a Forum Mod.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
23 Oct 2012 08:38 PM
Lol, wow.

http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information.
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
23 Oct 2012 09:13 PM
It simply negates a boolean.

not true ​> false
not false ​> true
not not true ​> true


Just like negating numbers:

-(1) = -1
-(-1) = 1
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image