So i have made a blocking script, it works fine, but just with a single problem, there's a duration on how long you can hold X to block, once this ends you are forced to stop blocking, but the problem is once i release X before the duration ends, the next time i will block it's duration is cut down by a lot, so i hinted it's because i am using the wait() but i have no idea on how to fix this.

LocalScript -

UIS.InputBegan:Connect(function(input, IsTyping) 
	if IsTyping == false and Check == true then
		if input.KeyCode == Enum.KeyCode.X then
                                Check = false
				BlockingStart:FireServer()
				print("Blocking Started")
				wait(5)
				print("5 Secs passed")
				BlockingEnd:FireServer()
				wait(1)
				Check = true
		end
	end
end)

8 comments

0

thats why debounce is a thing.

0

That is not the problem here...

0

I do not have a solution but you have not defined blockingstart or blockingend or UIS.

0

I think it's obvious that they both are remote events, and UIS is User input service.

0

yeah but in the script the remote events are not defined.

0

Is this the entire local script?

0

I don't know a lot srry