Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a keybind to only be pressed once and wait for a tween animation to play?

I am trying to make a ui tween animaition play using a keybind but what i came accross is that if you press the button multiple times, it messes up the tween.

here is the code

uis.InputBegan:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.RightBracket then
		if open == false then
			open = true
			adminConsole.Visible = true
			adminConsole:TweenPosition(
				UDim2.new(0.5, -50, 0.074, -50), 
				Enum.EasingDirection.Out, 
				Enum.EasingStyle.Quart, 
				1, 
				false 
			)
		end		wait(0.1)
	end			script.Parent.ConsoleUI.ConsoleClientScript.Disabled = false
end)
			

3 comments

0

You could try using the .Completed() event property of Tween https://developer.roblox.com/en-us/api-reference/event/TweenBase/Completed

0

You can't, it's only used on TweenService.

0

I tried doing so, its not working, could u give me an example

1 answer

Alright, upon reading your code, you have to add debounce which would prevent you to stop pressing the keycode quickly.

1 comment

0

I get that but how do i like temporarily disable a keybind

This discussion is preserved as it was. New answers, comments, and votes are closed.