How do i make a frame destory it self after reaching a certain size

im trying to make a frame destroy it self after reaching a certain size
robloxapp-20220422-1451535.wmv (396.0 KB)

i have tried this script

local ClickArea = script.Parent.Parent.Parent.Parent.ClickArea
local sound  = script.Parent.Parent.Parent.Parent.Sound
local progress = script.Parent

ClickArea.MouseButton1Click:Connect(function()
	sound:Play()
	if progress.Size == UDim2.new(0,562,0,28) then
		progress:Destroy() return end
	progress.Size += UDim2.new(0,70.25,0,0)
end)

but it dosent work

i need help on it

(this is a repost since the other post was not helpful)

This is just useless if its destroyed.

I think you’re supposed to add workspace.whatever.whatever.and.stuff here

Try something like this:

local Goal = UDim2.new(0,562,0,28)

ClickArea.MouseButton1Click:Connect(function()
	sound:Play()
	if (progress.Size.X.Offset >= Goal.X.Offset) then
        progress:Destroy() 
        return
    end
	progress.Size += UDim2.new(0,70.25,0,0)
end)

this error showed up
offset is not a valid member of udim

You spelled offest instead of offset:
if (progress.Size.X.Offest >= Goal.X.Offset) then

1 Like