Module =>
local Onx = setmetatable({}, {__index = function()
return error(-1)
end,})
function Onx:getState(ASSET : any, THREAD_OR_FUNCTION : "ThreadOrFunction")
if (typeof(THREAD_OR_FUNCTION) ~= 'function' or ASSET ~= nil) then
--<================================================================>
local Respond, Caught = pcall(coroutine.wrap(function()
return ASSET.Changed:Connect(THREAD_OR_FUNCTION)
end)) if not (Respond) then return error("Couldn't Update") end
--<================================================================>
else return error(string.format("Type Passed => %s", type(THREAD_OR_FUNCTION) )) end
end
return Onx
Server =>
local OpenOnx = require(game:GetService("ReplicatedStorage").OpenOnx)
local Part = game:GetService("Workspace").Part
OpenOnx.getState(Part, function()
print("Updated!")
end)
Part.Changed:Connect()
task.wait(5)
Part.BrickColor = BrickColor.Random()