Get all group models API?

So in my game Everlands, I have all the items that players can use uploaded as a model.

One of the reasons I created a group for the game is so that I can just fill the group’s model inventory with items.

I wish to simplify things with coding(/admin commands) and just use the name
So instead of doing

_G.giveItem("dispeller",2528526639)

I can just do

_G.giveItem("dispeller","apple")

This is how I am currently doing it:

itemNameIDs = {
	["apple"] = 2528526639,
	["basic sword"] = 2547563854,
	["flight potion"] = 2547734481,
}

--// function to get ID of item name
function findID(name)
	for i,v in pairs(itemNameIDs) do
		if string.find(i,string.lower(name)) then
			return v
		end
	end
end

Is there an easier more automatic method than having to add something to this table every time a new item is added to the game?

One of the reasons I’m asking is because I might let a few friends add their own items to the game.

Links:

Local Id = itemNameIDs[“Apple”]

No need to loop since you are using a dictionary.

5 Likes

I don’t think there is an easier way, as you’ll need to put the IDs somewhere – the way you have now is pretty good anyway. My game’s item system is more complex than yours, and I think it is pretty good too, so I doubt you have much to worry about :wink:

If you were really feeling the need to share it with people, you could create a Google Spreadsheet to hold your item index then give it a web app and stuff. You could share it with your friends, and you could even have items update without a game server being restarted as where the actual updating happens is on the spreadsheet. This method sounds great, but it’ll be a lot of work and not worth it for a Roblox game IMO.

2 Likes

@EmeraldSlash
Yeah I thought about having a separate thing like that as well, but that would just be a pain.

I could just have a module instead of a spreadsheet if I wanted to do that. :tongue:

@Fm_Trick
Actually, I have the loop so I can shorthand things when feeling lazy

so I could just be like

findID("app") -- returns 2528526639

Also, because I’m a lazy individual, I just have my admin commands be global with _G.
It’s actually pretty cool.

For an example, this is my giveGold command

_G.giveGold = function(p,a)
	if type(a) == "number" then
		p = findPlayer(p)
		giveGold:Invoke(p,a)
		print("Gave",p,a,"Gold")
	else
		warn("Can't give",a,"gold to",p"!")
		print'Maybe you got the vars switched?'
	end
end

So now, if I ever want to give gold to a player in game, I can just open up the dev console and type

_G.giveGold("disp",1234)
2 Likes

True but the module wouldn’t be editable by your friends (unless it was in group models or something) whereas with your spreadsheet you could easily share and manage the index.

There’s no Roblox Lua implementation which enables you to do that, however, you can use the catalog API to achieve this.

https://search.roblox.com/catalog/json?Category=6&CreatorId=840939346&IncludeNotForSale=true

3 Likes

Ive seen that and I don’t think that works with groups, only users

1 Like

The link above is exactly the one you’d want to use. Gives you the models for ‘Everlands’.

2 Likes

The link is only for users, not Groups

https://search.roblox.com/catalog/json?Category=6&CreatorId=4503265&IncludeNotForSale=true

1 Like

Oh wow I didn’t notice!
How did you get that ID?


image
I don’t know if there’s a quicker way, but this is simple enough.

3 Likes

I know this topic is old but how do I get that Id now as there is no such option available for groups now.

7 Likes