#table of hit players not being read?

1 messages · Page 1 of 1 (latest)

dawn marten
#

Hello! I have a hitbox module that has a built in table for hit players (hitbox.hitlist) that I am trying to then send to a VFX handler to process hit effects on the players. The problem is that it is not passing the table information over properly and is just sending an empty table. I want to be able to have a whiff animation if nothing hits as well so I want it to be outside of the touched event. (NOTE: This is not an actual .touched event, it is simply what the creator of the module uses for their GetPartsBoundInBox table!)
Server hitbox (Server Script)

#

Server Script:

--Begins VFX for Slam and validates the hit
config.slamVFX.OnServerEvent:Connect(function(plr)


    local pChar = plr.Character
    local hrp = pChar:WaitForChild("HumanoidRootPart")
    config.slamVFX:FireAllClients(plr)

    --If the hit is valid it gets sent to the VFX handler
    local validator = config.slamValidator.OnServerEvent:Connect(function(plr)
    
        task.delay(1.2, function()
            
            local hitbox = hitboxModule.CreateHitbox()

            local paramters = OverlapParams.new()
            paramters.FilterDescendantsInstances = {pChar}

            hitbox.Size = Vector3.new(10,5,10)
            hitbox.CFrame = hrp
            hitbox.VisualizerTransparency = 0.5
            hitbox.OverlapParams = paramters
            hitbox.VelocityPrediction = true
            hitbox.VelocityPredictionTime = 0.2

            hitbox:Start()

            hitbox.Touched:Connect(function(hit, vHum)

                local vChar = vHum.Parent
                local vrp = vChar:FindFirstChild("HumanoidRootPart")

                print(hitbox.HitList)

                task.delay(0, function()
                    knockbackModule.knockbackAttributes(plr, hrp, vChar, vrp, 10, 0, 40, 0)
                    print("Awarding points to "..plr.Name)
                end)
                
            end)
            
            config.slamValidator:FireAllClients(hitbox.HitList)
            
            task.delay(0.1, function()
                hitbox:Stop()
            end)
            
        end)    

    end)
    task.delay(1, function()
        validator:Disconnect()
    end)
end)
#

VFX Handler (Local Script)

--Slam VFX
config.slamVFX.OnClientEvent:Connect(function(plr)
    print("Playing VFX for Slam!")

    local pChar = plr.Character
    local pHum = pChar:WaitForChild("Humanoid")
    local hrp = pChar:WaitForChild("HumanoidRootPart")
    local pAnim = pHum.Animator:LoadAnimation(config.slamAnim)

    pAnim:Play()
    config.whoosh:Play()

    pAnim:GetMarkerReachedSignal("Knockback"):Connect(function()
        
        config.slamImpact:Play()
        
        local rocksClone = config.slamRocks:Clone()
        local primaryRock = rocksClone.PrimaryPart

        for _, effect in pairs (config.slamExplo:GetChildren()) do 
            local effectClone = effect:Clone()
            effectClone.Parent = primaryRock
        end

        local rockTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
        local rockTweenProperties = {
            ["CFrame"] = hrp.CFrame + Vector3.new(0,-3,0)
        }
        local rockTween = TS:Create(primaryRock, rockTweenInfo, rockTweenProperties)

        rocksClone:PivotTo(hrp.CFrame + Vector3.new(0,-5,0))
        rocksClone.Parent = workspace

        rockTween:Play()

        game.Debris:AddItem(rocksClone, 1.2)
        
        --Ability Victim VFX
        local validator = config.slamValidator.OnClientEvent:Connect(function(validHit)

            print(validHit)
            
            if #validHit >= 1 then
                print("Valid hit on VFX!")
                for _, vChar in pairs (validHit) do
                    
                end
            else
                print("Whiff on VFX!")
            end
        end)
        task.delay(1, function()
            validator:Disconnect()
        end)
        
    end)

end)
errant nymph
#

I'm confused, isn't it printing the humanoids in the output? That should be enough information

#

nvm, I'm blind

#

not a solution, but why did you place an OnServerEvent into the scope of another? That's a nested connection is it not?