How can I make a ring grow when a key is held?

So I was wondering how I could create a ring that grows similar to the E circles in Jailbreak when you hold them. I know about UserInputService and Enum.KeyCode, I just don’t know how I can do all of the ring animations.

Do you want to know how to size it during the key “E” being held or do you want to know HOW to make an “E” button?

I know about the key being held and all but I just don’t know how I can make the outer ring grow as it is being held.

I’m not sure since I haven’t tried it, but have you tried TweenService?

To make this happen, you’d want to have some form of variable such as
local E_Being_Held
Then using UserInputService , you can call InputBegan.

local UIS = game:GetService("UserInputService")
local KeyToHold = "E"
local E_Being_Held

UIS.InputBegan:Connect(function(input, processed)
   if not processed and input.UserInputType == Enum.UserInputType.Keyboard then
   local Key = input.KeyCode
   	if Key == Enum.KeyCode[KeyToHold] then
   		E_Being_Held = true
   		while E_Being_Held do
   			-- Resize the object you're trying to resize.
   		end
   	end
   end
end)

Once you have that set up, we can use InputEnded to change the E_Being_Held variable back to false.

UIS.InputEnded:Connect(function(input, processed)
	if not processed and input.UserInputType == Enum.UserInputType.Keyboard then
		local Key = input.KeyCode
		if Key == Enum.KeyCode[KeyToHold] then
			E_Being_Held = false
		end
	end
end)

Hope this helped a bit!

It’s very useful but I said I know how KeyCodes work…

I tried to answer this portion for you. Is your struggle finding the ring you’re trying to resize as well as the actual growing it portion?

Are you familiar with :GetMouse() and using mouse.Target?
Where is the Ring located? What IS the ring?

The way how Jailbreak does it is that they rotate the circle and use a spritesheet where the circle’s image constantly changes to another image of the spritesheet.

You can use this web app that generates a sprite sheet for radial / circular spritesheets. You could also refer to the devforum post about it

1 Like