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

Why is the screenGui not deleting itself when I want it to! Whats going on?

Asked by 8 years ago
Edited 8 years ago

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

1 answer

Log in to vote
1
Answered by 8 years ago

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.

0
Good Job! I suggest the OP reads http://wiki.roblox.com/index.php?title=API:Class/TextLabel (The repeat until loop the OP is using is also foolish, but everyone has their own way.) legoguy939 418 — 8y
0
Ty, I Changed the GUI at the end but I still had to use your code, At the end my script was 1318 lines long. spiderman90438 17 — 8y
Ad

Answer this question