Well, i could do it, but in my game, i would require to make 50+ values per person, and i just want to make it in a table (its eazier to read), and when you get more points, the table changes/updates.
Also you can get changed instance with parameter [maybe]
NumberValue:GetPropertyChangedSignal("Value"):Connect(function(Instance)
print('number value changed')
end)
Then you can created .Changed
function for your table, using metatables.
You can see the tutorial below to get the detailed explaination.
local Table = {}
-- if you want change table, do like this
table.insert(Table, 100) -- Value
-- Also do you want to remove
table.remove(Table, 1) -- Position of value. If table is {100, 200, 300} and want to remove 300 do table.remove(Table, 3)
The better way removing item from table is.
local index = table.find(Table,"ItemToFindAndRemove")
table.remove(Table, index)
Also they want to detect whenever the table is “changed” just like instances have .Changed function.
Changing the table is not my problem
Let me rewrite the question
This is my problem “Should i use events, to tell the script when to calculate something, and where should i store my data?” First problem solved!
Seems like a good use case for attributes.
How should i use this? Give this to the player humanoid?
Also cant hackers see other player stats ass well? Thats a huge problem in my game
Depends, if they need to be reset each time the player’s character is spawned then the player’s character should store the attributes, if they need to persist for a player’s entire play session then the player instance itself should store the attributes.
So, what if the values change a lot? ( I do not understand it entirely )
The attribute’s location doesn’t matter if its value is subject to frequent changes.
Ah, but can hackers/exploiters see the sttributes? Thats a big problem in my game.
They can see them but they can’t modify them.
Hmm, thats a big problem. Do you have anything that could work the same, but clients cant them?
Yeah, table values that only exist on the server.
Thank you for all your anvers. Now i know how to do it!!!