Help with table verification

I need to check if a name (String) is in the table, but I don’t really know how to do that!

local Auras_Particles = {
['Hand'] = {
["RedHandAura"] = 1000000,
["RedHandParticle"] = 1000000,

["PurpleHandAura"] = 1000000000,
["PurpleHandParticle"] = 1000000000,
};
if Auras_Particles.Hand[v.Name] then --- example!
print(v.name)
end

Think of it like a table with the objects inside of it having a value.

Auras_Particles.Hand.RedHandAura --Would be 1000000
for _, v in pairs(Auras_Particles.Hand) do
    if v == "RedHandAura" then
        print(v) -- 1000000
    end
end
1 Like

This code is missing a }, 1 more is needed

Also, note that you can do this if you want:

local Auras_Particles = {
Hand = 1000,
RedHandAura = 1000
}
1 Like

Note that there is an error. Here is some new code:

for i, v in pairs(Auras_Particles.Hand) do
    if i == "RedHandAura" then
        print(v) -- 1000000
    end
end
1 Like

I wanted an automatic code in my case or v. Serious name of a table I’ll put my code here!
This is my script!

local Auras_Particles = {
['Hand'] = {
["RedHandAura"] = 1000000,
["RedHandParticle"] = 1000000,

["PurpleHandAura"] = 1000000000,
["PurpleHandParticle"] = 1000000000,
};
['Leg'] = {
["LegAura"] = 100000,
["LegParticle"] = 100000,
}}


function Auras_Particles:SetHand (Char,PowerVlaue)
for i,v in pairs(Char:GetChildren()) do
	for i,v in pairs(v:GetChildren())do
		if Auras_Particles.Hand[v.Name] ~= nil then
			local ToTransparency = PowerVlaue/Auras_Particles.Hand[v.Name]
			if ToTransparency < 1 then
				v.Transparency = NumberSequence.new(1-ToTransparency)
			else
				local HandName = v.Name
				local Finish = false
				local NumberOfAura = nil
				
				for i = 1,#Auras_Particles.Hand do
					if Auras_Particles.Hand[i] == HandName then
						NumberOfAura = i
					end
				end
				wait()
				if not Auras_Particles.SetHand[NumberOfAura+2] then
						Finish = true
				end
				wait()
				if not Finish then
				ToTransparency = PowerVlaue/(Auras_Particles.Hand[NumberOfAura+2])
					if ToTransparency < 0 then
						ToTransparency = 0
					end
				v.Transparency = NumberSequence.new(ToTransparency)
				else
				v.Transparency = NumberSequence.new(0)
				end
			end
		end
	end
end
end

function Auras_Particles:SetLeg (Char,SpeedVlaue)
for i,v in pairs(Char:GetChildren()) do
	for i,v in pairs(v:GetChildren())do
		if Auras_Particles.Leg[v.Name] ~= nil then
			print(v.Name)
			local ToTransparency = SpeedVlaue/Auras_Particles.Leg[v.Name]
			if ToTransparency > 1 then
				ToTransparency = 1
			end
			v.Transparency = NumberSequence.new(1-ToTransparency)			
		end
		end
end
end


return Auras_Particles

(ModuleScript)

this will basically set the visibility of the “Aura” according to the player’s Power / Speed!