How To Make It That As Long I'm Holding A Button The Function Will Run?

I currently have this code that if you press a key, it’ll make your character faster. However, I want to make it that as long the button is held, the function will run. How can I achieve this?

UIS.InputBegan:Connect(function(input, isTyping)
	if isTyping then return end
	if input.KeyCode == RunButton then 
		Run()
	end
end)

UserInputService:IsKeyDown() should work

2 Likes

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