#for some reason my else statement just does not wanna play

10 messages · Page 1 of 1 (latest)

severe snow
#

heres the code calling the remote:

if config:FindFirstChild("ActiveSpell") then
    local activeSpell = config:FindFirstChild("ActiveSpell") and config.ActiveSpell.Value or "Lightning"
    local spellData = spellDataModule[activeSpell];
    animateTowerEvent:FireAllClients(newTower, "Attack", activeSpell, target)
    local castTime = ((spellData.CastTime or 1) - 0.5);
    task.wait(castTime + spellEffects[activeSpell][2](newTower, target))
    else
    print("not existing")
    animateTowerEvent:FireAllClients(newTower, "Attack", target)
end

heres the remote being called:

animateTowerEvent.OnClientEvent:Connect(function(tower, animName, spellEffectName, target)
    playAnimation(tower, animName)
    if target then
        if tower.Config:FindFirstChild("ActiveSpell") then
            fireSpell(tower, target, spellEffectName)
        else
            print("ay")
            fireProjectile(tower, target)
            tower.HumanoidRootPart.Attack:Play()
        end
    end
end)
#

so any tower that doesnt have "ActiveSpell" just doesnt wanna do the things contained in the else statement

quasi ridge
#

try local ActiveSpell = tower.Config:FindFirstChild("ActiveSpell")

if ActiveSpeel then
...
else
...

severe snow
#

and i mean it does print "not existing" from the server

#

but it just doesnt wanna do the things in the else statement

#

hold real quick

#

i mightve found out the issue

#

yup found out the issue

#

dont know why i was doing this on an else statement:

animateTowerEvent:FireAllClients(newTower, "Attack", target)