So basically, I have been looking around for a method/function that can match the string and then return the string it found. Just so I can find it and use it as a variable.

Here's my code:

for v, k in pairs(items) do
	print(v, k)
	for _, i in pairs(case:GetChildren()) do
		if string.match(i.Name, v) then
			local Chance = string.gmatch(i.Name, v)
			chances[v] = case[Chance].Value * 10000
		end		
	end
end

1 comment

0

gmatch returns an iterator function.