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: And Question

Previous Thread :: Next Thread 
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Sep 2011 11:33 AM
When you say a script that keeps on using and, and, and, and, and, for example

game.Workspace.Part:Remove() and game.Workspace.Part2:Remove() and...

How come it doesn't remove all thoughs parts?
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
24 Sep 2011 11:36 AM
Depends on what you use this
'and' is used for conditions for if, until or while.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
24 Sep 2011 11:41 AM
Because and returns a boolean. It isn't meant to concatenate code.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Sep 2011 11:43 AM
OH really? THen that's why...

So would then this work?

while wait(5) do
game.Workspace.miz656.Head:Remove() and game.Workspace.Coolguy.Head:Remove() and game.Workspace.miz.Head:Remove()
end

Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
24 Sep 2011 11:44 AM
Do not use and. If you read what at least one of us said, then you would realize that wouldn't work.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Sep 2011 11:47 AM
@Mrnicnac

Flox said use and for while and if ad I used a while loop :O
Report Abuse
nike6330 is not online. nike6330
Joined: 11 Feb 2009
Total Posts: 154
24 Sep 2011 11:49 AM
Samples to use;


blah = false
dha = false
repeat
if blah==false and dha==false then
blah=true
else
dha=true
end
until blah and dha

, Im not sure does it work..
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Sep 2011 11:51 AM
I want MrNicNac to answer my question :O He sounds like he knows what he's doing.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
24 Sep 2011 03:26 PM
When he said use and in a while loop, he meant in the condition at the top.

while (1 == 1) and (wait()) do -- Using and in conditional statements.
print("1 equals 1")
end
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
24 Sep 2011 03:27 PM
[ Content Deleted ]
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
24 Sep 2011 03:35 PM
examples of when to use 'and':
x,y = false,true
while x==false and y == true do
print 'lol'
wait()
end
if x == false and y == true then
print '>:D'
end
--I don't know how to use 'and' in for statements
repeat
print ':D'
wait()
until x == true and y == false
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Sep 2011 10:18 PM
Ok I THINK I know what you mean

Thanks :)
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
24 Sep 2011 10:31 PM
function _(x,z)
x,z=true,false
if not x and not z then
print("both false")
elseif (not(x)) and z or (not(z)) and x then
print("1 false")
elseif x and z then
print("both true")
end
end

­<'+1 Post. Ujelly?'>
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Sep 2011 10:58 PM
Uhh yeah thanks.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
24 Sep 2011 11:05 PM
So the answers to the test I gave you were fake, since you obviously don't know conditions as well as I thought you did.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
24 Sep 2011 11:23 PM
King, what test?

­<'+1 Post. Ujelly?'>
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
24 Sep 2011 11:26 PM
He asked me if he should keep studying Lua or is ready to learn a new language, and when I said he should keep studying Lua, he made me ask him a few questions. I gave him ones like, "What will this print, and *why*? print(true and false)"
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
24 Sep 2011 11:46 PM
^He said that too me too, after I said he should just stick with Lua for now.

­<'+1 Post. Ujelly?'>
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Sep 2011 01:12 PM
@Kingkiller

I knew the answer I just didn't get why. I've used and a lot of times and it only worked for the last line. I just didn't get why so that's why I posted this forum

@Nate

Yeah, I don't think I'm ready but yet I don't know what to study :o
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
25 Sep 2011 01:18 PM
The 'and' keyword will return true if all the linked statements are true, in case they aren not it will return false. It's as simple as that.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
25 Sep 2011 01:23 PM
print(not(false and(true)))

h4x

­<'+1 Post. Ujelly?'>
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
25 Sep 2011 01:23 PM
false and true == false
not (false and true) == not false
not false == true


c:

Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
25 Sep 2011 01:28 PM
^
function _(x,z)
x,z=true,false
if not x and not z then
print("both false")
elseif (not(x)) and z or (not(z)) and x then
print("1 false")
elseif x and z then
print("both true")
end
end



­<'+1 Post. Ujelly?'>
Report Abuse
dylanbuider is not online. dylanbuider
Joined: 14 Jun 2008
Total Posts: 17141
25 Sep 2011 01:46 PM
Ok...

'and' is used for multiple events with 'if'

Example:

if part.Name == "lol" and part.Transparency = 0.1 then
-- do this code
end


if the part has the right transparency, but the right name it will not continue, and vice-versa, BOTH have to be valid.
Report Abuse
dylanbuider is not online. dylanbuider
Joined: 14 Jun 2008
Total Posts: 17141
25 Sep 2011 01:48 PM
I ment if the part doesn't have, whoops.

Forgot to add and equal sign too, I was in a hurry..
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