local module = {}
function module.AddEffect(char,effect)
local character = char
local effects = character:WaitForChild("Effects")
local search = effects:GetDescendants()
for i,v in pairs(search) do
if v:IsA("BoolValue") and v.Name == effect then
v.Value = true
end
end
end
function module.RemoveEffect(char,effect)
local character = char
local effects = character:WaitForChild("Effects")
local search = effects:GetDescendants()
for i,v in pairs(search) do
if v:IsA("BoolValue") and v.Name == effect then
v.Value = false
end
end
end
function module.GetStatus(char, effect)
local character = char
local effects = character:WaitForChild("Effects")
local search = effects:GetDescendants()
for i,v in pairs(search) do
if v:IsA("BoolValue") and v.Name == effect then
return v.Value
end
end
end
function module.ClearAllEffects(char)
local effects = char:WaitForChild("Effects")
for i,v in pairs(effects:GetDescendants()) do
if v:IsA("BoolValue") then
v.Value = false
end
end
end
return module
This script keeps returning a ReplicatedStorage.EffectManager:8: attempt to index nil with ‘WaitForChild’ error, which doesn’t seem to be doing anything but is incredibly annoying. Can someone tell me why?