Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This script won't return end when it hits block part can anyone help?

Asked by 4 years ago
local Combo1 = RP.PunchEvents.Combo1

local BlockPart = game.Workspace:FindFirstChild("BlockPart")

Combo1.OnServerEvent:Connect(function(plr)
    local RigthArm = plr.Character["Right Arm"]

    plr.Character.Humanoid:LoadAnimation(script.LightAttackAnims.LightAttack1):Play()

    local CanTake = true
    local dmg = 5

    RigthArm.Touched:Connect(function(hit)

        if hit.Parent == plr.Character then return end
        if hit.Parent == BlockPart then return end
        if  hit.Parent:FindFirstChild("Humanoid") and CanTake == true then



            local enemyHum = hit.Parent:FindFirstChild("Humanoid")
            CanTake = false
            enemyHum:TakeDamage(dmg)

                end
    end)
end)

This script is supposed to return end when it hits block part but when it does it just deals damage can anyone help me?

0
your function runs before you even get to the return end part aprilsfooled 29 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

When you hit blockpart, hit.Parent would be workspace try

if hit==BlockPart then return;end;
0
It did not work and I got no errors FuZioNToxic 7 — 4y
0
Does that imply that BlockPart does not exist? SoftlockedUnderZero 668 — 4y
0
The part exists for sure. FuZioNToxic 7 — 4y
0
maybe the part didnt load yet, try local BlockPart = Workspace:WaitForChild("BlockPart") SoftlockedUnderZero 668 — 4y
View all comments (8 more)
0
Im gonna try when i wake up sorry for my late replies im just busy irl atm FuZioNToxic 7 — 4y
0
another suggestion: put the rightarm event on the outside of the Onserverevent, that event wont activate unless onserverevent is activated SoftlockedUnderZero 668 — 4y
0
The wait for child did not work and putting the righarm event outside of the onserverevent breaks it FuZioNToxic 7 — 4y
0
Again with no errors FuZioNToxic 7 — 4y
0
Anything special about variable blockpart or is it a regular part? SoftlockedUnderZero 668 — 4y
0
Just a normal part FuZioNToxic 7 — 4y
0
Oh well yoy better put some print functions just to check SoftlockedUnderZero 668 — 4y
0
Its quite clear, if the solution i provided doesnt work then theres something that i dont know SoftlockedUnderZero 668 — 4y
Ad

Answer this question