
KeylessUniversal

local RAY_IMAGE = "rbxassetid://1084982817"
local SUN_IMAGE = "rbxassetid://277033149"
local RAY_COLOR = Color3.new(1, 1, 1)
local RAY_ROTATION = -25
local MIN_BRIGHT_TRANS = 0.5
local SUN_SIZE = Vector2.new(0.2, 0.2)
local SUN_OFFSET = Vector2.new(0.004, 0.004)
local TWEEN_SPEED = 0.5
local RAY_DIST = {1.7; 0.3; -0.3; -0.9;}
local RAY_SIZES = {0.7; 0.2; 1.2; 0.45;}
local RAY_TRANS = {0.8; 0.7; 0.9; 0.6;}
local SUN_RAY_SIZE = 20
local SUN_RAY_TRANS = 0
local SUN_RAY_COLOR = Color3.new(1, 1, 0.95)
local lighting = game:GetService("Lighting")
local runService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local camera = workspace.CurrentCamera
local realMod = 1
local function Clip(n, l, h)
if n < l then return l end
if n > h then return h end
return n
end
local function GetSunPosition()
local screenPoint = camera:WorldToScreenPoint(camera.CoordinateFrame.p + lighting:GetSunDirection())
return Vector2.new(screenPoint.x, screenPoint.y), screenPoint.z > 0
end
local function ScreenCenter()
return camera.ViewportSize / 2
end
local function IsObstructed(ignore)
return workspace:FindPartOnRay(Ray.new(camera.CoordinateFrame.p, lighting:GetSunDirection() * 900), ignore) ~= nil
end
local function brightness(x)
return Clip(1 - (1 - MIN_BRIGHT_TRANS) * x, 0, 1)
end
local function OnCharacterAdded(character)
local root = character:WaitForChild("HumanoidRootPart")
local rays = {}
local screenGui
for _, child in pairs(script.Parent:GetChildren()) do
if child:IsA("ScreenGui") then
screenGui = child
break
end
end
if not screenGui then screenGui = Instance.new("ScreenGui", playerGui) end
local brightScreen = Instance.new("Frame", screenGui)
brightScreen.Name = "RayWashout"
brightScreen.Size = UDim2.new(2, 0, 2, 0)
brightScreen.BackgroundColor3 = RAY_COLOR
brightScreen.ZIndex = 10
brightScreen.Transparency = 1
brightScreen.AnchorPoint = Vector2.new(0.5, 0.5)
brightScreen.Position = UDim2.new(0.5, 0, 0.5, 0)
for i = 1, #RAY_DIST do
local ray = Instance.new("ImageLabel", screenGui)
ray.Name = "RayGhost"
ray.SizeConstraint = Enum.SizeConstraint.RelativeYY
ray.Size = UDim2.new(RAY_SIZES[i] * SUN_SIZE.x, 0, RAY_SIZES[i] * SUN_SIZE.y, 0)
ray.Rotation = RAY_ROTATION
ray.Image = RAY_IMAGE
ray.ImageColor3 = RAY_COLOR
ray.BackgroundTransparency = 1
ray.ImageTransparency = RAY_TRANS[i]
ray.ZIndex = 10
rays[#rays + 1] = ray
end
local sunRay = Instance.new("ImageLabel", screenGui)
sunRay.Name = "SunRay"
sunRay.SizeConstraint = Enum.SizeConstraint.RelativeYY
sunRay.Size = UDim2.new(SUN_RAY_SIZE * SUN_SIZE.x, 0, SUN_RAY_SIZE * SUN_SIZE.y, 0)
sunRay.Image = SUN_IMAGE
sunRay.ImageColor3 = SUN_RAY_COLOR
sunRay.BackgroundTransparency = 1
sunRay.ImageTransparency = SUN_RAY_TRANS
sunRay.ZIndex = 10
runService:UnbindFromRenderStep("SunRayReposition")
runService:BindToRenderStep("SunRayReposition", Enum.RenderPriority.Last.Value, function()
local sunPosition, isInFront = GetSunPosition()
local isClear = not IsObstructed((root.Position + Vector3.new(0, 1.5, 0) - camera.CoordinateFrame.p).magnitude < 1.1 and character or nil)
local targetMod = isClear and 1 or 0
realMod = realMod * (1 - TWEEN_SPEED) + targetMod * TWEEN_SPEED
local screenCenter = ScreenCenter()
local vec = sunPosition - screenCenter
for i = 1, #rays do
rays[i].ImageTransparency = 1 - realMod + RAY_TRANS[i] * realMod
local thisSize = rays[i].AbsoluteSize
local thisPosition = screenCenter + vec * RAY_DIST[i]
rays[i].Position = UDim2.new(SUN_OFFSET.x, thisPosition.x - thisSize.x / 2, SUN_OFFSET.y, thisPosition.y - thisSize.y / 2)
rays[i].Visible = isInFront
end
sunRay.ImageTransparency = 1 - realMod + SUN_RAY_TRANS * realMod
local sunRaySize = sunRay.AbsoluteSize
sunRay.Position = UDim2.new(SUN_OFFSET.x, sunPosition.x - sunRaySize.x / 2, SUN_OFFSET.y, sunPosition.y - sunRaySize.y / 2)
sunRay.Visible = isInFront
local cosAngle = camera.CoordinateFrame.lookVector:Dot(lighting:GetSunDirection())
brightScreen.Transparency = 1 - realMod + brightness(cosAngle) * realMod
end)
end
repeat task.wait() until player.Character
OnCharacterAdded(player.Character)
player.CharacterAdded:Connect(OnCharacterAdded)No comments yet for this script.



