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 » Scripters
Home Search
 

Re: Can u not

Previous Thread :: Next Thread 
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Apr 2015 07:25 PM
function mapSelect()
local mapStore = store:findFirstChild("maps")
local chosenMap = mapStore[math.random(1,#mapStore:getChildren())]
local map

for i,v in next, mapStore:getChildren() do
print(i..": "..v)
if i == chosenMap then
map = v
print(v)
end
end

return map
end

still returning a number... ?

i told it to return map! (v) which would be a model
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2015 07:31 PM
why don't you just return chosenMap, why have the loop at all... And also i will never be chosenMap because shoenMap is going to be an object
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Apr 2015 07:33 PM
because it's gonna return the actual map

and if i replace

if i == chosenMap then

with

if i == 1 then

it works fine? wtf?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2015 07:34 PM
Are you stupid, or are you just trolling?
If the latter, get out.

"it's gonna return the actual map"
"i told it to return map! (v) which would be a model"
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Apr 2015 07:35 PM
I'm not trolling... I'm serious.
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Apr 2015 07:35 PM
If I replace the var chosenMap with an actual int it does return the model... but I need it to work for chosenMap instead of an int because it needs to be random.
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Apr 2015 07:38 PM
wow... I realize why I'm stupid now.

I was setting it to mapStore[random int] and trying to compare an int to a userdata

wow

i feel stupid
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2015 07:40 PM
I still don't understand why you don't return the chosen map...
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Apr 2015 07:42 PM
because mapSelect() returns the actual userdata of the model.

later in the script i do

local map = mapSelect()

which is way easier than doing

local map = game.ServerStorage.maps[math.random(1,#game.ServerStorage.maps:getChildren())]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2015 07:43 PM
I don't know if you understand what I'm trying to say or not...
Whatever, if words won't help this should:

local mapSelect = function()
local children = store.maps:GetChildren();
return children[math.random(#children)];
end;

local map = mapSelect();
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
06 Apr 2015 07:44 PM
wait a second

i suddenly feel even stupider..

i didn't get what you were saying ugh i h8 my life
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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