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
Ok so I hope this helps.
Functions can be called from any where in a script
1 | function dothings(arugments) |
2 | return game.Version -- So when a function is called it has to return something so lets return the games version! |
3 | end |
4 |
5 | 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: