So I’m trying to create a script that will detect if a player is already afflicted with a status effect, and to do this I’m trying to create Bool Values with names labeling what status the person has. The script however, is reading through the first if statement and running the code under it, rather than any of the else statements. I’m not even worried about if the Bool Values will work, I’m just confused on how the script is finding children that dont exist. Here is the code:
ScripterAttack.OnServerEvent:Connect(function(player, Pos, info)
if info == "Malware" then
local Effects = Instance.new("Folder",workspace)
Effects.Name = player.Name.." Effects"
local Formula89Folder = Meshes:WaitForChild("Formula 89")
local Hitbox = Formula89Folder:WaitForChild("Formula89Hitbox"):Clone()
Hitbox.Position = Pos
Hitbox.CFrame = Hitbox.CFrame * CFrame.new(0,5,0)
Hitbox.Transparency = 0.5
Hitbox.Parent = Effects
local FailSafe = Formula89Folder:WaitForChild("FailSafe"):Clone()
FailSafe.Parent = Effects
Hitbox.Touched:Connect(function(hit)
if debounce == false then
debounce = true
local Enemy = hit.Parent
if Enemy:GetChildren("AdInfected" or "SpyInfected" or "RansomInfected") then
print"First"
elseif Enemy:GetChildren("MalInfected") then
print("Infected")
else
local MalSkullGUI = RP.MalSkullClosed:Clone()
MalSkullGUI.Parent = Enemy
local MalInfected = Instance.new("BoolValue")
MalInfected.Name = "MalInfected"
MalInfected.Parent = Enemy
print"Reading"
task.wait(2)
debounce = false
Hitbox:Destroy()
end
end
end)
end
end)```