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

Blocking works, but when the person is not blocking it still thinks they are?

Asked by 3 years ago
    HitBox.Touched:Connect(function(Hit)
            if Hit.Parent == Char or Hit.Parent.Parent == Char then return end
            if Hit.Parent ~= Char or Hit.Parent.Parent ~= Char then
                local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
                if Humanoid and cool == false and Humanoid.Health > 0 then 
                    cool = true
                    local Thingers 
                    Thingers = Hit.Parent
                    if Thingers:FindFirstChild("Blocking").Value == true then return end
                        local BeingHit = Humanoid.Parent:FindFirstChild("PlayerConditions")['IsBeingHit']
                        if BeingHit and BeingHit.Value == false then    
                            BeingHit.Value = true
                            local S = Instance.new("Sound", Humanoid) 
                            S.SoundId = "rbxassetid://566593606"
                            S.PlaybackSpeed = math.random(80,120)/100
                            S:Play()
                            local Track = Instance.new("Animation")
                            Track.AnimationId = "rbxassetid://5849561534"
                            local Anim = Humanoid:LoadAnimation(Track)
                            Anim:Play()
                            FX.Parent = workspace
                            FX.CFrame = Humanoid.Parent.HumanoidRootPart.CFrame*CFrame.new(math.random(-10,5)/15,math.random(-10,5)/15,math.random(-10,5)/15)
                            Humanoid:TakeDamage(7.5)
                            Stun(Humanoid)
                            wait(.35)
                            FX.Parent = nil
                            BeingHit.Value = false
                            cool = false
                        end
                    end
                    game.Debris:AddItem(HitBox, .13)
                end

        end)
    end
end)

I'm making a combat system and I have scripted the block. I can attack the dummy that has the blocking bool value turned to false, and cannot damage the dummy that has the blocking bool value turned to positive. This how it should be, however, when I go back to hit the dummy with the blocking value turned off I still cant damage it.

Here is a gif of what's happening: https://gyazo.com/decd6379ebe361d134a6aea67b38f784

Answer this question