Blocking system issues

I am trying to make a blocking system where i’ve added a boollvalue to the player and to other dummies the problem is when their blocking value changes it doesnt change in the hitbox script

hitbox.Touched:Connect(function(Hit)
		if Hit.Parent.Name ~= Player.Name and Hit.Parent:FindFirstChild("Humanoid")  and CanDamage == true then
			local isblocking = Hit.Parent:FindFirstChild("Blocking")
			if isblocking then
				if isblocking.Value == false then
					CanDamage = false


					Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
					if Count ~= 1 then
						sound:Play()
					else
						sound:Stop()
						sound2:Play()
					end
				elseif isblocking.Value == true then
					
				sound:Play()

			end
		
			end
			
		end
	end)
end)
1 Like

Do you have a statement where count adds one onto itself? if so can i see where it is?

I don’t understand

* sdawfdfaesfeasfwa

Here is the srver script

Replicated_Storage.Shield_ServerSide.Remotes.Hit.OnServerEvent:Connect(function(Player,Count)
	wait(0.25)
	print(Player)
	CanDamage = true
	local hitbox = Instance.new("Part",workspace)
	local sound = Instance.new("Sound",hitbox)
	
	local sound2 = Instance.new("Sound",hitbox)
	sound2.SoundId = script["Punch Kit Beefy Hit 2 (SFX)"].SoundId
	sound.SoundId = script.Metal_Hit.SoundId
	hitbox.Anchored = true
	hitbox.CanCollide = false
	hitbox.Transparency = 1
	hitbox.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
	hitbox.Size = Vector3.new(5,5,5)
	game.Debris:AddItem(hitbox,1)
	local hits = {}
	
	hitbox.Touched:Connect(function(Hit)
		if Hit.Parent.Name ~= Player.Name and Hit.Parent:FindFirstChild("Humanoid")  and CanDamage == true then
			local isblocking = Hit.Parent:FindFirstChild("Blocking")
			if isblocking then
				if isblocking.Value == false then
					CanDamage = false


					Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
					if Count ~= 1 then
						sound:Play()
					else
						sound:Stop()
						sound2:Play()
					end
				elseif isblocking.Value == true then
					
				sound:Play()

			end
		
			end
			
		end
	end)
end)

Maybe I misunderstood your post. Is the problem that you are having, trying to play one sound if the count is a certain number, and another if its a different number? Or can you elaborate what the issue is.

The main issue is that when the Dummy’s blocking value is changed to false or true the script runns on the first value

What is the isblocking variable?

Its boolValue

dsfaesgresdgrawesd

When you say if isblocking then, you’re essentially saying if isblocking == true then.

With that said, I don’t see anywhere in here where you switch the value of isblocking to false. Could that be it?

1 Like

No it still doesnt work when i change it

Do you have it like this?

if isblocking then
isblocking.Value = false

No i dont have it like this i have it like this

	if isblocking.Value == false then
					CanDamage = false


					Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
					if Count ~= 1 then
						sound:Play()
					else
						sound:Stop()
						sound2:Play()
					end
				elseif isblocking.Value == true then
					
				sound:Play()

			end
			end

Have you tested your other script to see if the boolvalue changes when you are blocking or not?

1 Like

Ooh no worries i added a script to the dummy that changes the value every 10 seconds and it worked
i think the script wont do when you r the one who changes it from the explorer

Sorry I couldnt have been of more help but glad you figured it out.

1 Like

Thanks alot for trying to help i appreciate that

1 Like

Make sure to mark yourself as the solution.

1 Like

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