Remote event table issues

Currently at a issue that my hitbox system can only hit 1 character safely.

currently i’m: making a variable true, Sending a remote to the client which is the hitbox, the client fires a remote event to the server with the contents, the server checks if the contetns are in range, and if the character and checking if that variable from before is true, and then sets it to false.

With this system you cannot make aoe skills. please help me to create a workaround.
(want to create a hitbox that can hit multiple enemies without being extremley exploitable)

Code:

local DamageFunc = function(item, floor, hitlist)
–Variables–
local sf = module.GetSfModule(char)
local echar = item.Parent
local ehum = echar:FindFirstChild(“Humanoid”)

if ehum == nil or hitlist[ehum] then
    return
end --checks if humanoid is hit, and checks if humanoid has already been hit



hitlist[ehum] = true


--variables--
local Downslam = false
local Damage = 0
local HyperArmor = false
local last = false
local player = nil

if CurrentCount >= 5 and floor == false and module.HyperArmor(echar) == false then
    Downslam = true
    Damage = 9
elseif CurrentCount >= 5 and floor then
    Damage = 7
    last = true
else
    Damage = 2
end --checks

if (echar.PrimaryPart.Position - char.PrimaryPart.Position).magnitude >= 10 then
    return
end

if module.IFrameCheck(echar)  then
    module.Counter(echar,char,(Damage * module.GetDmgMp(char) / module.GetDefenseMp(echar)))
    return
end --counter

if Downslam  then



    if game.Players:GetPlayerFromCharacter(echar) then
        player = game.Players:GetPlayerFromCharacter(echar)
    else
        player = game.Players:GetPlayerFromCharacter(char)
    end --checks player


    local velocity = (char.PrimaryPart.CFrame.LookVector * 1 + Vector3.new(0,-3,0)) * 25
    local bv = Instance.new("BodyVelocity", echar.PrimaryPart)
    bv.MaxForce = Vector3.new(35000,35000,35000)
    bv.Name = "DownslamVelocity"
    bv.Velocity = velocity --velocity

    module.NoReset(char,5)


    local stun = Instance.new("NumberValue")
    stun.Value = 0
    stun.Name = "Stunned" -- stun
    local DownSlamThing = Instance.new("BoolValue", stun)
    DownSlamThing.Name = "Downslam" -- stun slam

    module.Damage(Damage,echar,char) --damage

    DownslamEv:FireClient(player,echar)

else



    module.Damage(Damage,echar,char) --damage

    local velocity
    if CurrentCount < 5 then
        velocity = char.PrimaryPart.CFrame.LookVector * 8
        local bv = Instance.new("BodyVelocity", echar.PrimaryPart)
        bv.Velocity = velocity
        bv.MaxForce = Vector3.new(35000,35000,35000)
        local Sbv = bv:Clone() 
        Sbv.Parent = char.PrimaryPart
        debris:AddItem(bv, Windup) 
        debris:AddItem(Sbv, Windup)

    else
        velocity = char.PrimaryPart.CFrame.LookVector * 40
        local bv = Instance.new("BodyVelocity", echar.PrimaryPart)
        bv.Velocity = velocity
        bv.MaxForce = Vector3.new(35000,35000,35000)
        debris:AddItem(bv, 0.35) 
    end


    module.Stun(echar,0.5,0) -- stun

    HitVFX:FireAllClients(echar, false, false) --hitvfx

end --damage

end

DamageEv.OnServerEvent:Connect(function(player,Contents, floor)

if Debounce then
    return
end -- checks if player ability is actually on cd
Debounce = true


if type(Contents) ~= "table"  then
    return
end

if floor == false and CurrentCount >= 5 then        
    Animate:FireAllClients(CurrentCount, "DownSlam",char)
else
    Animate:FireAllClients(CurrentCount, "gagsagsa",char)
end


local hitlist = {}

for i,v in pairs(Contents) do
    spawn(function()
        DamageFunc(v, floor, hitlist)
    end)
end

end)

nvm i figured it out i’m ■■■■■■■■

solution:
Create a table of hitcharacters and set it to empty everytime the character uses t he skill :sob:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.