RBX docs Docs Idk

Pass by value vs reference

by:

Parihsz

Variables can be passed by value or by reference depending on their data type.

Below is an example of a variable being overwritten, instead of the value being changed:

local coins = player.leaderstats.Coins.Value
coins = 5

Here is the correct way to do it:

local coins = player.leaderstats.Coins
coins.Value = 5