Block value wont delete if i keep holding F key

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Made a blocking system, and made it if you get hit a certain amount of times, you get block broken.

  2. What is the issue? Include screenshots / videos if possible!
    it wont delete that value until you let go of the F key.

--Module that starts and ends block--
function functions.StartBlock(...)
	local things = ...;
	local char = things.char 
	local origin = things.origin -- Humanoid Root Part
	if char:FindFirstChild("Block") then return end --If youre already blocking, return
	if functions.abilityCheck({plr = things.plr, ability = "Block"}) then return end --Checks all states like "Attacked, Stunned, Blocking, Cooldown" at once
	functions.SetCharacterState(char, "Blocking") --State so i can add slow with an if function
	clientFX:FireAllClients("BlockFx", {origin = char.HumanoidRootPart, phase = 1}) --Just an effects event 
	local block ="NumberValue") -- Block value
	block.Name = "Block"
	block.Value = 40
	block.Parent = char
function functions.EndBlock(...)
	local things = ...;
	local char = things.char
	local block = char:FindFirstChild("Block")
	functions.RemoveCharacterState(char, "Blocking")
	if block then
		clientFX:FireAllClients("BlockFx", {origin = char.HumanoidRootPart, phase = 2}) -- Ends the effects
		block:Destroy() -- Destroys the value
		if things.BlockBreak then --Through info, if numbervalue <= 0 then i call the function EndBlock, only with {BlockBreak = true} in its info, so that way i can detect if you let go of F or you have gotten block broken.
			block:Destroy() --Destroys block, but it wont destroy it until you let go of letter F
			clientFX:FireAllClients("BlockBreak", {origin = char.HumanoidRootPart})
			clientFX:FireAllClients("Sound", {origin = char.HumanoidRootPart, Sound = repStorage.Effects.Sound.blockbreak})
1 Like

why not just add a task.wait after blocking then ending the block in the same function

1 Like

Not the problem, i set it up how its supposed to work and im running into a problem, im not gonna change the whole script now…

1 Like

I fixed the problem, it was that i was passing through my own character s an argument rather than “target”, so it was trying to find “block” value in myself rather than the enemy its hitting.

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