How to add a Blocking System for my tool?

  1. What do you want to achieve? I’m trying to create a tool when you only equip it and press F, the player will block.

  2. What is the issue? Whenever I equip the tool and press “F” then unequip it afterwards and press “F” again, the script still thinks I’m blocking.

  3. What solutions have you tried so far? I’ve only found those that doesn’t use tools for blocking systems.

Local Script

local function onEquip()
	equipSound:Play()
	toolEquipped = true
	idleTrack:Play()
	
	UIS.InputBegan:Connect(function(input, isTyping)
		if isTyping then return end
		if input.KeyCode == Enum.KeyCode.F then
			print("press F")
			speed(0, 0)
			print("Speed = 0")
			--blockAnim:Play()
			RS.Blocking:FireServer("On")
		end
	end)

	UIS.InputEnded:Connect(function(input, isTyping)
		if isTyping then return end
		if input.KeyCode == Enum.KeyCode.F then
			speed(16,50)
			--blockAnim:Stop()
			RS.Blocking:FireServer("Off")
		end
	end)
end

Thanks!

I just fixed it…

if anyone else has the same problem, I just made sure that the tool was parented to the character

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