What I am trying to do here/achieve here is the thing it fortnite kinda, the player drinks a mini shield and it has like the little countdown bit, however I want it to be the same thing but lets say I have a textlabel that says “E” to hold the E key.
I want like a little outline/bar/progress bar that goes round it and if the players stops holding the E key then I want it to slowly deplete.
How would I do that? I tried searching it up but I saw “Keybind door”
I know I can use the KeyHold thing but I don’t know how that could be used in this situation.
The ContextActionService may help on this. You should take it a look. Anyway, here’s some kinda example code.
Also, this from the UserInputService:
--[[ Varaibles ]]--
local uis=game:GetService("UserInputService");
--[[ Main ]]--
-- pressing
uis.InputBegan:connect(function(input)
if input.KeyCode==Enum.KeyCode.E then
print("pressing the key E");
-- your code here
end
end)
-- left
uis.InputEnded:connect(function(input)
if input.KeyCode==Enum.KeyCode.E then
print("you have stopped");
-- your code
end
end)
If you find any error, let me know. I’m gonna try to update the script as soon as possible. For the GUI decreasing and increasing, you should have a number value and from there and on just tween the GUI.
As I already said you should have a NumberValue for this. When the player is drinking the shiel potion just go and increase the value. With the NumberValue increasing Tween the GUI (you can make calculations of how the GUI can actually tween because you’ll need to divide or multiply some Vectors of the GUI).
Anyway, isn’t that difficult and you could just go and search on Youtube “How to make a Stamina Bar” or a “Tweening GUI from a value”.
If we could apply soulutions on more than 1 post then I would mark both of them
I could make a square progress bar instead or use the grey background/shadow as the progress bar and the white “E” text with increasing TweenSize (if you know what I mean).
Hey! I have just read a little discusion of what plugin would better. So… I got one that is the best so far! This one have a lot of features instead of only roundify.