Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Unable to cast Array to int?

Asked by 9 years ago
local Tool = game:GetService("InsertService"):LoadAsset(List[math.random(#List)])

List is a table of tables containing information about the gear it's loading, but I can't get it to load Output : Unable to cast Array to int? Format of the tables

List = {
[1] = {[1] = "16895215"; [2] = "Darkheart"; [3] = "246454502"; [4] = "It's darker than RGB(0,0,0) and it steals \n life from your enemies. What more is there to say."};
[2] = {[1] = "23727705"; [2] = "Spec Epsilon Biograft Energy Sword"; [3] = "246455445"; [4] = "The superintelligent cloud people of the \n distant future find the history of human conflict hilarious and ironic."};
[3] = {[1] = "14876573"; [2] = "Spec Beta Biograft Energy Sword"; [3] = "246456657"; [4] = "In 2113, decades after the initial release of the hugely successful Spec Alpha biograft energy weapons"};
[4] = {[1] = "16641274"; [2] = "Illumina"; [3] = "246455445"; [4] = "Telamon's favorite weapon from Sword Fight on the Heights."};
}

1 answer

Log in to vote
3
Answered by 9 years ago

If what you're saying is you have a table of tables. You are trying to load an asset which is a number with a table. I don't have all the information so I kind of have to guess here but. I'm assuming you have a value in the table named "ID" and it is a NUMBER.

local Tool = game:GetService("InsertService"):LoadAsset(List[math.random(#List)].ID) --Adding ID after will grab the ID value of the table. 

In other words you're using a table where a number should be.

3
The id # is listed in the table as a string BSIncorporated 640 — 9y
3
nvm i got it BSIncorporated 640 — 9y
3
Congrats on becoming a Scholar = BSIncorporated 640 — 9y
1
Thanks :D YellowoTide 1992 — 9y
Ad

Answer this question