#HELP

1 messages · Page 1 of 1 (latest)

languid lintel
#

PLEASE

#

local punchEvent = game.ReplicatedStorage.Punch

punchEvent.OnServerEvent:Connect(function(player)
local character = player.Character
if not character then return end
local humanoid = character:WaitForChild("Humanoid")
local animations = script.Animations
local punchAnimation = animations.Punch
local punch2Animation = animations.Punch2
local damage = math.random(3, 5)

local chosenAnimation = math.random(1, 2) == 1 and punchAnimation or punch2Animation
local animTrack = humanoid:LoadAnimation(chosenAnimation)
animTrack:Play()

local swingSound = script.Sounds.PunchSwing:Clone()
swingSound.PlaybackSpeed = math.random(85, 120) / 100
swingSound.Parent = character.HumanoidRootPart
swingSound:Play()
game.Debris:AddItem(swingSound, 1)

local punchSound = script.Sounds.Punch1:Clone()
punchSound.PlaybackSpeed = math.random(85, 120) / 100
punchSound.Parent = character.HumanoidRootPart
punchSound:Play()
game.Debris:AddItem(punchSound, 1)

local hitbox = Instance.new("Part")
hitbox.Size = Vector3.new(5, 6, 5)
hitbox.Position = character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector * 3
hitbox.Anchored = true
hitbox.Transparency = 1
hitbox.CanCollide = false
hitbox.Material = Enum.Material.ForceField
hitbox.Color = Color3.fromRGB(255, 0, 0)
hitbox.Parent = workspace

game.Debris:AddItem(hitbox, 0.2)

local hitboxCooldown = false
hitbox.Touched:Connect(function(hit)
    if hitboxCooldown then return end
    local target = hit.Parent
    if target and target:FindFirstChild("Humanoid") and target ~= character then
        hitboxCooldown = true
        target.Humanoid:TakeDamage(damage)
        local hitAnim = target.Humanoid:LoadAnimation(script.Hit)
        hitAnim:Play()
        game.Debris:AddItem(hitAnim, 1)
        hitboxCooldown = false 
    end
end)

end)

#

ITS NOT DEALING 3 OR 5 DAMAGE

#

instead its dealing like 50 or 40

#

plus the swing/punch sounds play at once

#

everytime i click

#

I NEED HELP BADLY THIS IS PISSING ME OFF

naive isle
#

Can u codeblock it

languid lintel
#

i cant 😭

naive isle
#

u can

#

it shows how to in the sticker i sent

#

everyone can do that

languid lintel
#

i know that

#

i dont have nitro

#

im poor af

naive isle
#

U dont need nitro???

languid lintel
naive isle
#

maybe remove something and send it seperately idk

#

its not that many characters so

languid lintel
#

ok

#
local punchEvent = game.ReplicatedStorage.Punch

punchEvent.OnServerEvent:Connect(function(player)
    local character = player.Character
    if not character then return end
    local humanoid = character:WaitForChild("Humanoid")
    local animations = script.Animations
    local punchAnimation = animations.Punch
    local punch2Animation = animations.Punch2
    local damage = math.random(3, 5)

    local chosenAnimation = math.random(1, 2) == 1 and punchAnimation or punch2Animation
    local animTrack = humanoid:LoadAnimation(chosenAnimation)
    animTrack:Play()

    local swingSound = script.Sounds.PunchSwing:Clone()
    swingSound.PlaybackSpeed = math.random(85, 120) / 100
    swingSound.Parent = character.HumanoidRootPart
    swingSound:Play()
    game.Debris:AddItem(swingSound, 1)

    local punchSound = script.Sounds.Punch1:Clone()
    punchSound.PlaybackSpeed = math.random(85, 120) / 100
    punchSound.Parent = character.HumanoidRootPart
    punchSound:Play()
    game.Debris:AddItem(punchSound, 1)```
#
    local hitbox = Instance.new("Part")
    hitbox.Size = Vector3.new(5, 6, 5)
    hitbox.Position = character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector * 3
    hitbox.Anchored = true
    hitbox.Transparency = 1
    hitbox.CanCollide = false
    hitbox.Material = Enum.Material.ForceField
    hitbox.Color = Color3.fromRGB(255, 0, 0)
    hitbox.Parent = workspace

    game.Debris:AddItem(hitbox, 0.2)

    local hitboxCooldown = false
    hitbox.Touched:Connect(function(hit)
        if hitboxCooldown then return end
        local target = hit.Parent
        if target and target:FindFirstChild("Humanoid") and target ~= character then
            hitboxCooldown = true
            target.Humanoid:TakeDamage(damage)
            local hitAnim = target.Humanoid:LoadAnimation(script.Hit)
            hitAnim:Play()
            game.Debris:AddItem(hitAnim, 1)
            hitboxCooldown = false 
        end
    end)
end)```
naive isle
#

Its cause all 6 limbs on the character can trigger .Touched events

#

So if both the left leg and right leg touch something with a .Touched event, itll trigger it twice