Hi, can you provide the code you’re using to tween the button? More than likely, your old tween is overriding your new tween when you let go of the button.
Just to let you know for next time-- sometimes it’s hard to read code in a screen shot. Try avoiding this by formatting your code in using this button
First of all, you should be using TweenService and creating a new Tween instead of TweenSize because it’s deprecated.
Although, try adding another paramer to TweenSize with the value true. If it doesn’t work, let me know.
(i.e Storage.Icon:TweenSize(arg, arg, arg, arg, true)
You could use a variable and runservice to change and update the status like this.
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local MobileButtonDown = false
UIS.InputBegan:Connect(function(Input, IsTyping)
if not IsTyping then
if Input.KeyCode == Enum.KeyCode.C then
MobileButtonDown = true
end
end
end)
UIS.InputEnded:Connect(function(Input, IsTyping)
if not IsTyping then
if Input.KeyCode == Enum.KeyCode.C then
MobileButtonDown = false
end
end
end)
RunService.RenderStepped:Connect(function()
if MobileButtonDown == true then
-- code for making player sprint
else
-- code for making player stop sprinting
end
end)
That’s unnecessary and would end up calling tween service more times than it should. If it’s true, it’ll continuously call tween service when it’s already finished EVERY FRAME, and vice versa.
You’re better off not using TweenSize in the first place, since TweenService overrides old tweens anyway
(roblox documentation)
Also, does the UI fix itself if you click the same keybind again?
I know the post is already solved, but you shouldn’t be creating a connection without disconnecting it inside InputBegan, which fires each time a player presses a key. Therefore, InputEnded will be connected every time the player presses a key, leading to memory leaks. Avoid this by using :Wait or :Once, or just move InputEnded:Connect outside the anonymous function.