Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I want my gui size to change But it wont change when I run my script?

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)

1 answer

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)

3 comments

0

that doesn't do anything. Is it maybe because im using a local script?

0

Its suppose to be in a local script

0

Are there any errors?

This discussion is preserved as it was. New answers, comments, and votes are closed.