-- Made script that shrinks a frame as I hold down button.
Why it not work?
local uis = game:GetService("UserInputService") local shrinking = false local r = 1/1000 -- gui should shrink by 0.1% on wait() but doesn't 0.001 as a percentage is 0.1% local gui = script.Parent -- change this at your discretion function Shrink() shrinking = true while shrinking do local s = gui.Size gui.Size = s - UDim2.new(s.X.Scale*r,s.X.Offset*r,s.Y.Scale*r,s.Y.Offset*r) end end uis.InputBegan:connect(function(input,gp) if input.UserInputType == Enum.UserInputType.Keyboard and gp then if input.KeyCode == Enum.KeyCode.LeftShift then Shrink() end end end) uis.InputEnded:connect(function(input,gp) if input.UserInputType == Enum.UserInputType.Keyboard and gp then if input.KeyCode == Enum.KeyCode.LeftShift then shrinking = false end end end)
Here is the problem:
uis.InputBegan:connect(function(input,gp) if input.UserInputType == Enum.UserInputType.Keyboard and gp then
"gp" is a bool that stands for Game Processed Event, which is only true when the input happened upon an interface. You most likely DON'T want this, because then your function only works when you type into chat. Therefore you should say "and (not gp)" at the end of both functions.
Fixed:
uis.InputBegan:connect(function(input,gp) if input.UserInputType == Enum.UserInputType.Keyboard and (not gp) then