I have a screenGui script that makes a intro in this game (For a tutorial video) and for some reason it won't delete it self after I properly do the screenGui:Destroy()
and frame:Destroy()
Here is the script if you need it
local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent local frame = Instance.new("Frame") frame.Parent = screenGui frame.Position = UDim2.new(0, 0, 0, -50) frame.Size = UDim2.new(0, 1400, 0, 1500) wait (2) local textLabel = Instance.new("TextLabel") textLabel.Parent = screenGui textLabel.Position = UDim2.new(0, 300, 0, 400) textLabel.Size = UDim2.new(0, 25, 0, 50) textLabel.BackgroundColor3 = BrickColor.White().Color textLabel.Text = "Buttery Toast presents" textLabel.BackgroundTransparency = 1 textLabel.Font = ("Legacy") textLabel.FontSize = 8 a = 0 repeat textLabel.Position = UDim2.new(0, a, 0, 400) wait (0.001) a = a+10 until textLabel.Position == UDim2.new(0, 600, 0, 400) wait (2) local textLabel = Instance.new("TextLabel") textLabel.Parent = screenGui textLabel.Position = UDim2.new(0, 600, 0, 490) textLabel.Size = UDim2.new(0, 25, 0, 50) textLabel.BackgroundColor3 = BrickColor.White().Color textLabel.Text = "Lake Side View" textLabel.BackgroundTransparency = 1 textLabel.Font = ("Bodoni") a = 0 repeat textLabel.FontSize = a wait (0.001) a = a+2 until textLabel.FontSize == 14 wait (4) screenGui:Destroy() frame:Destroy()
HELP ME
The problem is that FontSize
is an Enum, not a number. Therefore, you should replace lines 40-45 with the following:
for i, v in ipairs(Enum.FontSize:GetEnumItems()) do print(v.Name) textLabel.FontSize = v wait(0.001) -- You may find that this is too small. if v == Enum.FontSize.Size14 then break end end
This will work fine for your case (up to size 14), but you may need to sort the result of GetEnumItems()
if you plan on going much higher.