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

Why is a TextLabel not subtracting its Transparency?

Asked by 6 years ago

I am Seisimotic and I was making a intro, just for fun, and while I was making it and testing the intro out, I realized that one of the TextLabels aren't subtracting its Transparency to be visible.

NOTE: I'm not a "God" at scripting gui's so, you may have to show me the code.

01--CODE--
02local click_sound = script.Parent.Parent.Parent:WaitForChild("click_sound")
03 
04script.Parent.MouseButton1Click:Connect(function()
05    click_sound:Play()
06 
07    script.Parent.Visible = false
08    script.Parent.Parent.skipintroButton.Visible = false
09    script.Parent.Parent.TextLabel.Visible = false
10    script.Parent.Parent.loadedLabel.Visible = false
11 
12    wait(2)
13    while wait() do
14        script.Parent.Parent.title.TextTransparency = script.Parent.Parent.title.TextTransparency - 0.01
15        script.Parent.Parent.title.TextStrokeTransparency = script.Parent.Parent.title.TextStrokeTransparency - 0.01
View all 24 lines...

1 answer

Log in to vote
0
Answered by
Rawblocky 217 Moderation Voter
6 years ago
Edited 6 years ago

You are making it repeat wait() in a loop without a stop. Replace "while wait() do" to "while script.Parent.Parent.title.TextTransparency>0 do"

I recommend using TweenService instead of adding/subtracting the transparency of the text, which will also work. It also makes the code simpler and it's much easier.

01--CODE--
02local click_sound = script.Parent.Parent.Parent:WaitForChild("click_sound")
03 
04script.Parent.MouseButton1Click:Connect(function()
05    click_sound:Play()
06 
07    script.Parent.Visible = false
08    script.Parent.Parent.skipintroButton.Visible = false
09    script.Parent.Parent.TextLabel.Visible = false
10    script.Parent.Parent.loadedLabel.Visible = false
11 
12    wait(2)
13game:GetService('TweenService'):Create(script.Parent.Parent.title,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{TextTransparency=0,TextStrokeTransparency=0}):Play()
14 
15    wait(2)
16game:GetService('TweenService'):Create(script.Parent.Parent.author,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{TextTransparency=0,TextStrokeTransparency=0}):Play()
17 
18end)

[the 1 in TweenInfo.new(1,Enum.EasingStyle is the amount of seconds of how long the tweening is] [by the way if the text gets cutted up hover over the code and click "view source"]

Ad

Answer this question