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

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

Asked by
Kervos 15
6 years ago
Edited 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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:

Ad

Answer this question