Can i send math through events?

Lets say i have 1 script that changes a value by whatever number is in a received event.

and the other script is trying to add to that value

Is there a way to add through a event, even though the receiving one doesnt have any code to account for that?

1 Like

BTW, this is for a save data script. one event controls all player values, so i cant easily add code to account for math problems.

You could send a table with the operation, like the string “add” and some arguments

how would i do that?
(i cant access studio, and idk why…)

You can try adding instance of type “NumberValue” or “IntValue” and calculate things on them. You can then get the instance’s value. Here’s an example :

local object ="NumberValue")
object.Name = "Calculated"
object.Value = --any math you do
object.Parent = workspace --or anywhere

And then you’d fetch that value from anywhere using workspace.Calculated.Value.
Make sure you fetch the value after that it was calculated though

seems a lot more complicated then the other guys suggestion

No matter what you’d have to modify the code that saves the value. Then use a remote and pass options:
MyUpdateFunc.FireServer(“add”, 15)
The receiving function can support whatever operation string you want to use.

ill see if my scripter can add something like that then

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.