Module Script:
Functions.Event = function(event, instance, callback, ...:any)
local event = instance[event]
local args = {...}
event:Connect(function(...:any)
callback(table.unpack(args), ...)
end)
end
Local Script:
local BindableFunction = function(rollframeclone, Heartbeat, tween1, tween2, roll)
local childrens = rollframeclone:GetChildren()
for _,v in pairs(childrens) do
if not v:IsA("TextButton") then continue end
Event("Activated", v, v_Ativado, v, tween1, tween2, Heartbeat, rollframeclone, roll)
end
end
local v_Ativado = function(v, tween1, tween2, Heartbeat, rollframeclone, roll)
local nome = v.Name
local bindable = bindablefunction:Invoke(nome, roll)
local escolhido = rollframeclone[t[not bindable]]
local nomeescolhido = tostring(escolhido)
local deletadoescolhido = WaitFor(rollframeclone, nomeescolhido)
v.Active = false
for numero = 0, 1, 0.1 do
task.wait(0.05 + Heartbeat:Wait())
deletadoescolhido.TextTransparency = numero
end
coroutine.wrap(function()
while Heartbeat:Wait() do
task.wait(0.3)
v.TextColor3 = Color3.new(1, 1, 0.411765)
task.wait(0.3)
v.TextColor3 = Color3.new(255,255,255)
end
end)()
Destroy_Instance(deletadoescolhido)
Tween_Audio_Play(tween1)
Completed(tween1, Tween_Audio_Play, tween2)
end
My problem here is: Heartbeat, rollframeclone, and roll are returning nil when it is passed onto the “Event” function.
I tried printing it before passing it to the “Event” function and it prints the normal value. When I removed callback(table.unpack(args), ...)
with callback(table.unpack(args))
it worked.
What is the problem here?
What I’m trying to reach is to pass arguments of the Event:Connect(). Some events don’t have arguments, so sometimes the table would be nil, nothing. Is it the problem?