So what i’m trying to do is match a table string name with another table function name, here’s the code:
local AllSkills = {
"PilarBelowPlayer",
"PilarSomewhere",
"EarthShield",
}
local SkillFunctions = {
PilarBelowPlayer = function(Character:Model)
print("XD")
end,
}
SkillsRemote.OnServerEvent:Connect(function(Player, Skill:string)
print(Player)
for _, v in ipairs(AllSkills) do
if Skill == v then
print("YES")
for __, skill in ipairs(SkillFunctions) do
--[[Here the skill name would match with
the Skill Function name ("PilarBelowPlayer" as an example, and then it would
search in the SkillFunctions table any function that is named the same as the
Skill name, and after there is a match, the function would be
executed)]]
end
else
print("No")
end
end
end)
I’ve tried to use table.find but it didn’t work, i’m not new in Lua but not an expert too, and this is the first time i’m using tables so I don’t understand some stuff (most of it, at least for now), any help and explanation would be really appreciated!