Im Trying to Have The gui Be a certain size when i press it and go down when i stop pressing but it wont change the size
local player = game.Players.LocalPlayer local uis = game:GetService("UserInputService") local gui = game.StarterGui:WaitForChild("ScreenGui") uis.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.F then gui.Frame = UDim2.new(10, 10, 10, 10) print("Down") end end) uis.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.F then gui.Frame = UDim2.new(0, 0, 0, 0) print("UP") end end)
UDim2 changes the position or size while you are trying to change an instance. Instead of:
gui.Frame = UDim2.new(10, 10, 10, 10)
do:
gui.Frame.Size = UDim2.new(10, 10, 10, 10)