I want the screen to fade into white basically.
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then
local player = game.Players:FindFirstChild(hit.Parent.Name)
if player:FindFirstChild("PlayerGui"):FindFirstChild("ScreenGui") == nil then
sg = Instance.new("ScreenGui")
sg.Parent = player:FindFirstChild("PlayerGui")
end
if player.PlayerGui.ScreenGui:FindFirstChild("MessageBox") == nil then
local f = Instance.new("Frame")
f.Name = "WhiteFrame"
f.Position = UDim2.new(0, 0, 0, 0)
f.Size = UDim2.new(1,0, 1,0)
f.Parent = player.PlayerGui:FindFirstChild("ScreenGui")
f.BackgroundTransparency = 1
f.BackgroundColor3 = Color3.fromRGB(255,255,255)
if f.Name == ("WhiteFrame") and f.BackgroundTransparency ~= 1 then
for i=1, 10 do
wait(0.1)
f.BackgroundTransparency = f.BackgroundTransparency - 0.1
end
wait(.5)
for i=1, 10 do
wait(0.1)
f.BackgroundTransparency = f.BackgroundTransparency + 0.1
end
end
end
wait(10)
f:Destroy()
end
script.Parent.Touched:connect(onTouch)

1 comment
http://wiki.roblox.com/index.php?title=Writing_Clean_Code#Indenting