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: trouble with else

Previous Thread :: Next Thread 
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
10 Aug 2014 01:02 AM
I'm trying to use this function to determine whether someone has too much of one object, but if once object has a value of 5 ore more, it prevents people form picking up other objects no matter what



countFull = function()
for xCount = 1, width.Value do
for yCount = 1, height.Value do
if Backpack["coordinate {"..xCount..", "..yCount.."}"].item.Value ~= "" then
local itemType = _G.globalTable.itemType(Backpack["coordinate {"..xCount..", "..yCount.."}"].item.Value);
if itemType ~= "Assault" and itemType ~= "Burst" and itemType ~= "Submachine" and itemType ~= "Pistol" then
if Backpack["coordinate {"..xCount..", "..yCount.."}"].count.Value >= 5 then
if itemType == "Explosive Object" then
return true;
elseif itemType == "Health" then
return true;
end
end
end
end
end
end
return false;
end
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
10 Aug 2014 01:13 AM
BoolValue?

I don't know much Lua, so sorry if this seems useless.
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
10 Aug 2014 01:29 AM
it's for number variables

1
Report Abuse
ZT6 is not online. ZT6
Joined: 24 Dec 2012
Total Posts: 225
10 Aug 2014 01:31 AM
Why not Int?
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
10 Aug 2014 02:54 AM
oh yeah they are int values


2
Report Abuse
Brickman2010 is not online. Brickman2010
Joined: 20 Nov 2009
Total Posts: 5547
10 Aug 2014 03:48 AM
Question here:

if itemType == "Explosive Object" then
return true;
elseif itemType == "Health" then
return true;

why not just:

if itemType == "Explosive Object" or itemType == "Health" then
return true

?
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
10 Aug 2014 04:15 PM
@Brick, Because if either one of those haz a count value of 5, I won't be able to collect any more items. I wanted to try and keep the statements seperate so ti would only take affect on different items, but it isn't
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
10 Aug 2014 06:39 PM
2
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