Oh, no. Its more like you deal 100 dm and the other user has 10 dev than you deal 90 dm instead of 100
How do you get // caculate the damage?
Its just a value in a table (thats not where i am stuck)
So then top damage minus least damage is what your telling me
(anticipation)
Yeah but i want to get the stats, but how should i do that? ( Basicly thats the question) and do this 10x over to calculate the damige (use 10 different stats, like how tired you are and things like that)
Like should i use events, to tell the script when to calculate something, and where should i store my data?
Its pretty simple.
local stats = {
["Synitx"] = {Damage = 100},
["ROBLOX"] = {Damage = 10}
}
local roblox = game.Players.ROBLOX
local formula = (stats.Synitx.Damage - stats.ROBLOX.Damage)
roblox.Character.Humanoid:TakeDamage(formula)
Yeah this is kinda what i want but when can i see if the damige changes? Also thx. ( Like you equip new sword)
Your stats is in table I suppose?
I prefer you to make damage a number value for every player in leaderstats.
You can use
NumberValue:GetPropertyChangedSignal("Value"):Connect(function()
print('number value changed')
end)
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 )