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

how can i make the dialog fade out?

Asked by
omorizz 50
2 years ago

i have this fading dialog script, but theres 2 problems with it. the first is, it only fades in and then stays forever, it wont fade out. the second problem is it doesn't show text, it just shows a white screen (background transparency is set to 1 on frame and textlabel)

local TS = game:GetService("TweenService")

local Trigger = workspace.Trigger
local TextLabel = script.Parent

local debouce = false

local time = 1 
local function onTouched(hit)
    if not debounce then
        if not hit then return end
        debouce = true
        TS:Create(TextLabel, TweenInfo.new(time, Enum.EasingStyle.Quad), {Transparency = 1}):Play() 
        wait()
        TS:Create(TextLabel, TweenInfo.new(time, Enum.EasingStyle.Quad), {Transparency = 0}):Play() 
    end
end
Trigger.Touched:Connect(onTouched)

1 answer

Log in to vote
0
Answered by 2 years ago

It is possible that you didn't give the tween enough time. Increase the wait maybe to time or add a + 0.5 if it doesn't work.

TS:Create(TextLabel, TweenInfo.new(time, Enum.EasingStyle.Quad), {Transparency = 1}):Play() 
wait(time) -- or more if it doesn't work
TS:Create(TextLabel, TweenInfo.new(time, Enum.EasingStyle.Quad), {Transparency = 0}):Play() 

As soon as the tween plays, without finishing, it moves to the next line. Make sure you give more time to the tween.

Ad

Answer this question