Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how does this custom function work, and what is the output when its called?

Can someone explain to me how this works and what it does?

GetItemData = function(name)
return game.ReplicatedStorage.Database.Items[name]
end

I'm mainly confused on what the output of name would be, and how would it work when you're calling the function? Sorry if this question seems a little vague, i read about custom functions on the wiki but i just don't really get it, they don't really explain too deeply on it and just give 1 example

1 answer

Ok so I hope this helps.

Functions can be called from any where in a script

function dothings(arugments)
	return game.Version -- So when a function is called it has to return something so lets return the games version!
end

local version = dothings(arugments) -- Now we can use the game version and do what ever we want with it.

So in your case where you are returning game.ReplicatedStorage.Database.Items[name]

That would return a whole model for you to clone, move set to a different parent anything that you could do with a normal part/model.

Hopefully this helped! When I was first starting out I was really confused. If this did work please check this as correct! Have a great day! c:

This discussion is preserved as it was. New answers, comments, and votes are closed.