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

How do you make the screen fade into white when a specific object is touched?

Asked by 8 years ago
Edited 8 years ago

I want the screen to fade into white basically.

01function onTouch(hit)
02 
03    if hit.Parent:FindFirstChild("Humanoid") ~= nil then
04 
05        if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then
06        local player = game.Players:FindFirstChild(hit.Parent.Name)
07 
08            if player:FindFirstChild("PlayerGui"):FindFirstChild("ScreenGui") == nil then
09            sg = Instance.new("ScreenGui")
10            sg.Parent = player:FindFirstChild("PlayerGui")
11 
12end
13 
14    if player.PlayerGui.ScreenGui:FindFirstChild("MessageBox") == nil then
15 
View all 41 lines...

1 answer

Log in to vote
1
Answered by 8 years ago
1repeat
2    f.Transparency = f.Transparency - 0.1
3until f.Transparency == 0
4wait(0.5)
5repeat
6    f.Transparency = f.Transparency + 0.1
7until f.Transparency == 1

is that simple enough?

0
The only problem I can see is if the starting transparency is 0.95 then it will never hit 0 and would loop forever. You could fix this by changing "until f.Transparency == 0" and "until f.Transparency == 1" to "until f.Transparency <= 0" and "until f.Transparency >= 1" shadownetwork 233 — 8y
Ad

Answer this question