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: How do I fix this?

Previous Thread :: Next Thread 
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 03:37 PM
I'm trying to find the index in a folder where it's located in ServerStorage. A random index is chosen in the table, then added in the table 'receiveAssetsD', and initially trying to locate it in the folder to destroy it. How do I fix this error?

local StorageServer = game:GetService('ServerStorage')
local DangerImg = StorageServer.GameCore.TileImages.Danger:GetChildren()
local receiveAssetsD = {}

local Sorting = function()
for i = 1,5 do
table.insert(receiveAssetsD, DangerImg[math.random(#DangerImg)])
local hide = StorageServer.GameCore.TileImages.Danger:FindFirstChild(DangerImg[math.random(#DangerImg)])
hide:Destroy()
wait(.1)
end
applyAssetToButton()
end

button.MouseButton1Down:connect(Sorting)


Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 03:38 PM
It'd help if you posted the error.
Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 03:39 PM
04:31:45.558 - Players.Player1.PlayerGui.MenuUI.CoreGame.StartUP:21: attempt to index local 'hide' (a nil value)


Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 03:42 PM
try removing the FindFirstChild, it's an error I get sometimes.
Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 03:43 PM

local StorageServer = game:GetService('ServerStorage')
local DangerImg = StorageServer.GameCore.TileImages.Danger:GetChildren()
local receiveAssetsD = {}

local Sorting = function()
for i = 1,5 do
table.insert(receiveAssetsD, DangerImg[math.random(#DangerImg)])
local hide = StorageServer.GameCore.TileImages.Danger[DangerImg[math.random(#DangerImg)])]
hide:Destroy()
wait(.1)
end
applyAssetToButton()
end

button.MouseButton1Down:connect(Sorting)
Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 03:45 PM
But what's another way in locating the index? Or say locating the value that's in the folder, but has the same name as the index.


Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 03:45 PM
I'll try that right now on what you've posted.


Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 03:47 PM
It kind of posted this,

04:47:40.496 - Players.Player1.PlayerGui.MenuUI.CoreGame.StartUP:20: bad argument #2 to '?' (string expected, got Object)


Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 03:50 PM
I'm trying to think of other solutions on how to do it, just isn't coming in mind. :/


Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 03:50 PM
whoops

local StorageServer = game:GetService('ServerStorage')
local DangerImg = StorageServer.GameCore.TileImages.Danger:GetChildren()
local receiveAssetsD = {}

local Sorting = function()
for i = 1,5 do
table.insert(receiveAssetsD, DangerImg[math.random(#DangerImg)])
local hide = StorageServer.GameCore.TileImages.Danger[DangerImg[math.random(#DangerImg)]).Name]
hide:Destroy()
wait(.1)
end
applyAssetToButton()
end

button.MouseButton1Down:connect(Sorting)
Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 03:53 PM
Whoa it worked, but threw a error because it didn't find the object in the folder xD, but still worked :o. I'm going to rewrite my code again, but will include on the information you've posted. Thank you LockFocus, it was a pleasure of you helping me. :)


Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 03:54 PM
no probs
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
26 Sep 2016 04:17 PM
you call math.random when adding the danger image to the table, and then again when actually destroying it
it selects 2 different ones, i'd imagine thats the issue

local StorageServer = game:GetService('ServerStorage')
local DangerImg = StorageServer.GameCore.TileImages.Danger:GetChildren()
local receiveAssetsD = {}

local Sorting = function()
for i = 1,5 do
local img=DangerImg[math.random(#DangerImg)]
table.insert(receiveAssetsD, img)
img:Destroy()
wait(.1)
end
applyAssetToButton()
end

button.MouseButton1Down:connect(Sorting)
Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 04:18 PM
Yeah, I actually noticed that xD.


Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
26 Sep 2016 04:18 PM
I was like 'what the heck is wrong with me' o.O
But thank you for still telling me :P


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