Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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)
0
that doesn't do anything. Is it maybe because im using a local script? FilthyMonsterPlays 8 — 3y
0
Its suppose to be in a local script JustinWe12 723 — 3y
0
Are there any errors? JustinWe12 723 — 3y
Ad

Answer this question