Input ended not workings

Have a framework with string values as the Enum.KeyCode.F for example, im trying to make blocking work and the input ended isnt really working, or idk how to set it up

These are the skills example:
image
I use them and their value for example “Fire Ball” to make abilities.


This else statement at the end is for input ended, idk what to put there do trigger release of F key :skull:

2 Likes

I’m not sure but you do know that UserInputService has InputBegan and InputEnded right? I think state might be a boolean, which i am not sure, but nonetheless, it’s still counts as an InputBegan, not Ended.

2 Likes

Yes, i have to detect when i press F to create a boolean on block, after i release it i destroy the boolean. Do you know how to detect the release of the F key beneath the ‘else’ statement at the bottom of the 2nd image screenshot

2 Likes

Just make it two seperate functions?

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.F then
		
	end
end)

UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.F then

	end
end)
3 Likes

Youre clearly not understanding me, regardless thanks for your attempt to help me.

1 Like

I do understand what you mean. It’s just that it doesn’t make sense: else refers to something not related to the if. And you can’t check in an inputbegan if a keycode has been released.

3 Likes
if state then
--code
else
--code
end

in this case, state is Input began, else is inputended, i frameworked it that way im just confused on one part but ive figured it out nvm

2 Likes