#how can i automatically run a function when i change a value?

1 messages · Page 1 of 1 (latest)

hidden epoch
#

i want it so when i do bezier.DebugApproximation = n, it automatically redraws the path of the bezier to be more or less accurate, depending on n.

local Bezier = require(game.ReplicatedStorage.Modules.Helper.Bezier)
local bezier = Bezier.new({
    Vector3.new(0.5, 2, 28.4),
    Vector3.new(15.8, 7.2, 24),
    Vector3.new(15.8, 30.8, 38.5),
    Vector3.new(-45.3, 15.1, 51.3)
})
bezier:TogglePath(true)
task.spawn(function()
    while true do
        for i = 1, 4 do
            bezier.DebugApproximation = i
            task.wait(1)
        end
    end
end)

basically, how would i detect every time i try to change bezier.DebugApproximation?

#

i think its something to deal with __newindex

#

but im not sure

#

how can i automatically run a function when i change a value?

glossy scarab
#

use changed funtion like plr:getattribut():attributechangedsignal: connect(function ())

hidden epoch
#

i thought i deleted this

#

what