Код может конфликтовать с другой системой Player Exp?

Я сделал боевую систему, то есть если игрок убивает манекена, то игрок получает очки силы. У меня вопрос, может ли мой код вызывать вылет и конфликтовать с боевой системой другого игрока? Код ниже:

      local replicated = game:GetService("ReplicatedStorage")
local combatevent = replicated.CombatSkills.Combat
local servstore = game:GetService("ServerStorage")
local runservice = game:GetService("RunService")
local db = true

combatevent.OnServerEvent:Connect(function(Player)
    combatevent:FireClient(Player)
    local char = Player.Character or Player.CharacterAdded:Wait()
    local hbox = Instance.new("Part")
    hbox.Size = Vector3.new(2,2,2)
    hbox.Anchored = true
    hbox.CanCollide = false
    local chance = math.random(1,2)
    local animation = Instance.new("Animation")
    animation.AnimationId = "rbxassetid://10497535355"
    animation.Parent = char.Humanoid
    local animationleft = Instance.new("Animation")
    animationleft.AnimationId = "rbxassetid://10501415181"
    animationleft.Parent = char.Humanoid
    local connection = runservice.Heartbeat:Connect(function(dt)
        if chance == 1 then
            hbox.Position = char.RightHand.Position
        elseif chance == 2 then
            hbox.Position = char.LeftHand.Position
        end
    end)
    local tconnection = hbox.Touched:Connect(function(hit)
        local hum = hit.Parent:FindFirstChild("Humanoid")
        if hum then
            if hum ~= char.Humanoid and db then
                db = false
                hum.Health -= 12
                task.wait(0.2)
                db = true
            end
        end
    end)
    for i, v in pairs(workspace:GetChildren()) do
        if v.Name == "Dummy" then
            v.Humanoid.Died:Connect(function()
                local creator = v.Humanoid:FindFirstChild("creator")
                if creator and creator.Value then
                    local Data = creator.Value:WaitForChild("leaderstats")
                    Data.Strenght.Value += 5
                end
            end)
        end
    end
    if chance == 1 then
        local loadanim = char.Humanoid:LoadAnimation(animation)
        loadanim:Play()
    elseif chance == 2 then
        local loadleft = char.Humanoid:LoadAnimation(animationleft)
        loadleft:Play()
    end 
    hbox.BrickColor = BrickColor.new("Really red")
    hbox.Transparency = 1
    hbox.Parent = workspace
    task.wait(.3)
    hbox:Destroy()
    tconnection:Disconnect()
    connection:Disconnect()
end)

(я не знаю, есть ли ошибка в коде, но на выходе нет ошибок).

0 ответов

Другие вопросы по тегам