How do I find a function with a value iterated through a loop. Not sure if I said that write but code will pretty much explain.
self.AnimationFunctions = {
["Dash"] = function(distance)
print(distance)
end,
["Stun"] = function(amount)
print(amount)
end,
}
for i, v in pairs(Events) do
self.Combos[attack[self.Current].Track:GetMarkerReachedSignal(tostring(v)):Connect(function(value)
print(v) -- Prints Dash
self.AnimationFunctions[v](value) -- Attempted to call nil value.
end)
end
The value prints out 5, as the parameter is and the events table is a table which contains all of the animation events in an animation track. And V prints out the event name.