Block system is glitchy

Hello!
I tried to make a block system and when i hold my Right mouse button it acting weird

Clip:

This is local script

game:GetService("RunService").Heartbeat:Connect(function()
	if  script.Parent.Values.Busy.Value == false and script.Parent.Values.Block.Value == false and  game:GetService("UserInputService"):IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
		script.Block:FireServer("Block")
	elseif  script.Parent.Values.Busy.Value == true and script.Parent.Values.Block.Value == true and  game:GetService("UserInputService"):IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
		script.Block:FireServer(nil)
	
	end
end)

This is script

script.Parent.Block.OnServerEvent:Connect(function(p, type)
	if type == "Block" and script.Parent.Parent.Values.Busy.Value == false then
		script.Parent.Parent.Values.Block.Value = true
		script.Parent.Parent.Values.Busy.Value = true 
	elseif type == nil then
		script.Parent.Parent.Values.Block.Value = false
		script.Parent.Parent.Values.Busy.Value = false
	end
end)

I tried to make like you cant swing while you are blocking but it gone wrong

Does the block work but the animation is glitch or doesnt the block work at all?

I solved it, but thanks for trying to help me!

2 Likes

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