Hello, I’m trying to use i,v in pairs to scan through my character and locate 3 specific instances, being 3 particle emitters all with different names, down below is that section of code.
Event.OnServerEvent:Connect(function(Player, Key)
if Key == "CursedEnergyOff" then
local Char = Player.Character or Player.CharacterAdded:Wait()
for i,v in ipairs(Char:GetDescendants()) do
if v.Name == "CursedEnergy" then
end
end
end)
I’ve got 3 particles, “CursedEnergy”, “Glow”, and “Body”, how could I basically check if anything has one of those 3 names?
Just making sure I am getting what your saying, you want to check if any of the particle emitters have either the names, “CursedEnergy”, “Glow”, and “Body”?
If that’s the case then do this:
local namesToBeSearched = {"CursedEnergy", "Glow", "Body"}
Event.OnServerEvent:Connect(function(Player, Key)
if Key == "CursedEnergyOff" then
local Char = Player.Character or Player.CharacterAdded:Wait()
for i,v in ipairs(Char:GetDescendants()) do
if table.find(namesToBeSearched, v.Name) then --the rest
end
end
end)
Explanation on what’s going on:
It will check if the instance’s name is included in the table, namesToBeSearched and if it is then blah blah blah.
This world does not deserve people like you I swear, thank you, this little thing was picking at my brain for a good while now. Thank you for helping me on this, genuinely.