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

How to Insert a value in a Dictionary?

Asked by 5 years ago

I want a global table in which it has all the trees in the game, which are generated automatically. for example: it has the "Main" region and it has the tree in a module, "Common" (this creates a model of a tree), which will appear in a random position of the "Main" region. Okay, but I wanted to have a table that has several values, such as: Tree (the model), Owner (the player who cut the tree), Value (the value that the player will receive when selling the wood), InnerWoodColor (to use in the module that creates the innerwood), InnerWoodMaterial (for the innerwood module). but I need the values ??to be added when the tree "is born", but I do not know how to do it is part. (I have a script that has a Global variable called "Trees" and I want the values ??to be added there). and I do not know how to use these values ??in the table, for example: when the player tries to cut a tree and the player is not in that value in the tree he is trying to cut (_G.Trees = {[(the tree that player is trying to cut)] = {["Owner"] = (player)}}). so the player can't cut the tree

the FE is activated. If it got too confusing I can try to explain it again. thanks any help.

0
piece of advice, don't use _G, use modules or bindables instead theking48989987 2147 — 5y
0
but how can I store the values and get them in another script Caniisu 2 — 5y
0
Module scripts Vmena 87 — 5y

Answer this question