Advertisement
Descaii

Lense Flare

Aug 4th, 2014
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.07 KB | None | 0 0
  1. -- Sun glare --
  2. local Lighting=game:GetService("Lighting")
  3. local P=Instance.new("Part",Workspace.CurrentCamera)
  4. P.Anchored=true
  5. P.Transparency=1
  6. local B=Instance.new("BillboardGui",P)script.Parent=nil
  7. B.Size=UDim2.new(0,500,0,500)
  8. B.Adornee=P
  9. local I=Instance.new("ImageLabel",B)
  10. I.Size=UDim2.new(1,0,1,0)
  11. I.BackgroundTransparency=1
  12. I.Image="http://www.roblox.com/asset/?id="..68993706-1--131425040-1
  13. local S=Instance.new("ScreenGui",game.Players.LocalPlayer.PlayerGui)
  14. local F=Instance.new("Frame",S)F.Size=UDim2.new(1,0,1,0)
  15. function glerp(UD1,UD2,a)
  16.     return UDim2.new(
  17.         UD1.X.Scale+((UD2.X.Scale-UD1.X.Scale)*a),
  18.         UD1.X.Offset+((UD2.X.Offset-UD1.X.Offset)*a),
  19.         UD1.Y.Scale+((UD2.Y.Scale-UD1.Y.Scale)*a),
  20.         UD1.Y.Offset+((UD2.Y.Offset-UD1.Y.Offset)*a)
  21.     )end
  22. function lerp(a,b,c)
  23.     return a+((b-a)*c)
  24. end
  25. ASpeed = 0.2
  26. F.BackgroundColor3 = Color3.new(1,1,1)
  27. local C=I:clone()C.Parent=B C.Image="http://www.roblox.com/asset/?id="..127639227-1 C.Size=UDim2.new(0.5,0,0.5,0)C.Position=UDim2.new(0.25,0,0.25,0)
  28. local D=I:clone()D.Parent=B D.Image="http://www.roblox.com/asset/?id="..137748388-1 D.Size=UDim2.new(0.8,0,0.8,0)D.Position=UDim2.new(0.1,0,0.1,0)
  29. game:GetService("RunService").RenderStepped:connect(function()
  30.     local C=Lighting:GetSunDirection()
  31.     local G=Workspace.CurrentCamera.CoordinateFrame
  32.     local N=G+(C*1000)
  33.     local H=C:Dot(G.lookVector)
  34.     local AX=1-(H-0.5)
  35.     local OX=(H)
  36.     local Rot = {Workspace.CurrentCamera.CoordinateFrame:toEulerAnglesXYZ()}
  37.     local SZ = UDim2.new(0,500*OX,0,500*OX)
  38.     local SZ2 = UDim2.new(0,200*OX,0,200*OX)
  39.     local Hit,Pos = Workspace:findPartOnRay(Ray.new(G.p,N.p),game.Players.LocalPlayer.Character)
  40.     I.Rotation = Rot[1]+Rot[2]+Rot[3]
  41.     if not Hit then
  42.         I.ImageTransparency=lerp(I.ImageTransparency,AX,ASpeed)
  43.         F.BackgroundTransparency = lerp(F.BackgroundTransparency,AX,ASpeed)
  44.         B.Size=glerp(B.Size,SZ,ASpeed)
  45.     else
  46.         I.ImageTransparency = lerp(I.ImageTransparency,AX+0.5,ASpeed)
  47.         F.BackgroundTransparency = lerp(F.BackgroundTransparency,AX+0.5,ASpeed)
  48.         B.Size=glerp(B.Size,SZ2,ASpeed)
  49.     end
  50.     P.CFrame=N
  51. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement