
KeylessUniversal

-- UltraAtmosphereEffects.client.lua
-- À placer dans StarterPlayer > StarterPlayerScripts
-- Effets : mort, soleil/éblouissement, eau HD + éclaboussures,
-- effet inquiétant quand la caméra regarde un autre joueur.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local camera = Workspace.CurrentCamera
-- =========================================================
-- CONFIGURATION
-- =========================================================
local CONFIG = {
DeathDarkness = 0.75,
DeathTime = 1.8,
SunLookDot = 0.965, -- Plus proche de 1 = il faut regarder plus précisément le soleil
SunBlindTime = 3,
SunBlindCooldown = 4,
SunSlowSpeed = 7,
PlayerLookDistance = 80,
PlayerLookDot = 0.992,
PlayerDarkness = 0.28,
PlayerShake = 0.22,
WaterCheckDistance = 12,
SplashCooldown = 0.35,
}
-- =========================================================
-- POST-PROCESSING HD
-- =========================================================
local function getOrCreate(className, name)
local obj = Lighting:FindFirstChild(name)
if not obj then
obj = Instance.new(className)
obj.Name = name
obj.Parent = Lighting
end
return obj
end
local color = getOrCreate("ColorCorrectionEffect", "UltraHD_Color")
color.Enabled = true
color.Brightness = 0
color.Contrast = 0.12
color.Saturation = 0.05
local bloom = getOrCreate("BloomEffect", "UltraHD_Bloom")
bloom.Enabled = true
bloom.Intensity = 0.35
bloom.Size = 28
bloom.Threshold = 1.2
local rays = getOrCreate("SunRaysEffect", "UltraHD_SunRays")
rays.Enabled = true
rays.Intensity = 0.08
rays.Spread = 0.8
local deathBlur = getOrCreate("BlurEffect", "UltraHD_Blur")
deathBlur.Enabled = true
deathBlur.Size = 0
local atmosphere = Lighting:FindFirstChildOfClass("Atmosphere")
if atmosphere then
atmosphere.Density = math.clamp(atmosphere.Density, 0, 0.45)
end
-- Eau plus brillante / transparente (effet visuel global)
local terrain = Workspace:FindFirstChildOfClass("Terrain")
if terrain then
terrain.WaterTransparency = 0.18
terrain.WaterReflectance = 0.35
terrain.WaterWaveSize = 0.25
terrain.WaterWaveSpeed = 12
end
-- =========================================================
-- ÉTAT
-- =========================================================
local humanoid
local rootPart
local originalWalkSpeed = 16
local sunBlindActive = false
local sunCooldown = false
local playerEffect = 0
local lastSplash = 0
-- =========================================================
-- MORT : caméra/écran qui s'assombrit
-- =========================================================
local function deathEffect()
TweenService:Create(color, TweenInfo.new(CONFIG.DeathTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
Brightness = -CONFIG.DeathDarkness,
Contrast = 0.25,
Saturation = -0.7,
}):Play()
TweenService:Create(deathBlur, TweenInfo.new(CONFIG.DeathTime), {
Size = 14,
}):Play()
end
local function resetDeathEffect()
TweenService:Create(color, TweenInfo.new(1), {
Brightness = 0,
Contrast = 0.12,
Saturation = 0.05,
}):Play()
TweenService:Create(deathBlur, TweenInfo.new(0.7), {
Size = 0,
}):Play()
end
-- =========================================================
-- ÉBLOUISSEMENT DU SOLEIL
-- =========================================================
local function sunIsAbovePlayer()
if not rootPart then
return false
end
-- Le soleil doit être au-dessus de l'horizon du joueur.
-- On vérifie la composante verticale de la direction du soleil.
local sunDirection = Lighting:GetSunDirection()
return sunDirection.Y < -0.02
end
local function triggerSunBlind()
if sunBlindActive or sunCooldown or not humanoid then
return
end
sunBlindActive = true
sunCooldown = true
originalWalkSpeed = humanoid.WalkSpeed
humanoid.WalkSpeed = math.min(originalWalkSpeed, CONFIG.SunSlowSpeed)
TweenService:Create(color, TweenInfo.new(0.25, Enum.EasingStyle.Quad), {
Brightness = 0.35,
Contrast = 0.2,
Saturation = -0.25,
}):Play()
TweenService:Create(bloom, TweenInfo.new(0.25), {
Intensity = 1.2,
Size = 50,
Threshold = 0.35,
}):Play()
TweenService:Create(rays, TweenInfo.new(0.25), {
Intensity = 0.38,
Spread = 1,
}):Play()
task.wait(CONFIG.SunBlindTime)
if humanoid and humanoid.Health > 0 then
humanoid.WalkSpeed = originalWalkSpeed
end
TweenService:Create(color, TweenInfo.new(0.7), {
Brightness = 0,
Contrast = 0.12,
Saturation = 0.05,
}):Play()
TweenService:Create(bloom, TweenInfo.new(0.7), {
Intensity = 0.35,
Size = 28,
Threshold = 1.2,
}):Play()
TweenService:Create(rays, TweenInfo.new(0.7), {
Intensity = 0.08,
Spread = 0.8,
}):Play()
sunBlindActive = false
task.wait(CONFIG.SunBlindCooldown)
sunCooldown = false
end
-- =========================================================
-- EFFET QUAND ON REGARDE UN AUTRE JOUEUR
-- =========================================================
local function lookingAtAnotherPlayer()
if not camera or not rootPart then
return false
end
local camPos = camera.CFrame.Position
local camLook = camera.CFrame.LookVector
for _, other in ipairs(Players:GetPlayers()) do
if other ~= player and other.Character then
local otherRoot = other.Character:FindFirstChild("HumanoidRootPart")
local otherHumanoid = other.Character:FindFirstChildOfClass("Humanoid")
if otherRoot and otherHumanoid and otherHumanoid.Health > 0 then
local offset = otherRoot.Position - camPos
local distance = offset.Magnitude
if distance <= CONFIG.PlayerLookDistance and distance > 0 then
local direction = offset.Unit
local dot = camLook:Dot(direction)
if dot >= CONFIG.PlayerLookDot then
return true
end
end
end
end
end
return false
end
-- =========================================================
-- EAU : détection + éclaboussures quand on entre dans l'eau
-- =========================================================
local function createSplash(position)
if time() - lastSplash < CONFIG.SplashCooldown then
return
end
lastSplash = time()
local attachmentPart = Instance.new("Part")
attachmentPart.Name = "WaterSplashVisual"
attachmentPart.Anchored = true
attachmentPart.CanCollide = false
attachmentPart.CanQuery = false
attachmentPart.CanTouch = false
attachmentPart.Transparency = 1
attachmentPart.Size = Vector3.new(0.2, 0.2, 0.2)
attachmentPart.Position = position
attachmentPart.Parent = Workspace
local emitter = Instance.new("ParticleEmitter")
emitter.Texture = "rbxasset://textures/particles/sparkles_main.dds"
emitter.Rate = 0
emitter.Lifetime = NumberRange.new(0.35, 0.8)
emitter.Speed = NumberRange.new(7, 14)
emitter.SpreadAngle = Vector2.new(180, 180)
emitter.Drag = 5
emitter.Acceleration = Vector3.new(0, -Workspace.Gravity * 0.7, 0)
emitter.Size = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0.35),
NumberSequenceKeypoint.new(0.45, 0.18),
NumberSequenceKeypoint.new(1, 0),
})
emitter.Parent = attachmentPart
emitter:Emit(45)
-- Petites ondulations/flaques visuelles
for i = 1, 3 do
local ring = Instance.new("Part")
ring.Name = "WaterRipple"
ring.Anchored = true
ring.CanCollide = false
ring.CanTouch = false
ring.CanQuery = false
ring.Shape = Enum.PartType.Cylinder
ring.Material = Enum.Material.Glass
ring.Transparency = 0.55
ring.Size = Vector3.new(0.05, 0.1, 0.05)
ring.CFrame = CFrame.new(position + Vector3.new(math.random(-2, 2), 0.02, math.random(-2, 2)))
* CFrame.Angles(0, 0, math.rad(90))
ring.Parent = Workspace
local tween = TweenService:Create(ring, TweenInfo.new(0.7), {
Size = Vector3.new(0.05, 3 + i * 1.5, 3 + i * 1.5),
Transparency = 1,
})
tween:Play()
tween.Completed:Connect(function()
ring:Destroy()
end)
end
task.delay(1.5, function()
if attachmentPart then
attachmentPart:Destroy()
end
end)
end
local function bindCharacter(character)
humanoid = character:WaitForChild("Humanoid")
rootPart = character:WaitForChild("HumanoidRootPart")
originalWalkSpeed = humanoid.WalkSpeed
resetDeathEffect()
humanoid.Died:Connect(deathEffect)
local lastState = humanoid:GetState()
humanoid.StateChanged:Connect(function(_, newState)
if newState == Enum.HumanoidStateType.Swimming
and lastState ~= Enum.HumanoidStateType.Swimming
and rootPart then
createSplash(rootPart.Position)
end
lastState = newState
end)
end
if player.Character then
task.spawn(bindCharacter, player.Character)
end
player.CharacterAdded:Connect(bindCharacter)
-- =========================================================
-- BOUCLE PRINCIPALE
-- =========================================================
RunService:BindToRenderStep("UltraAtmosphereEffects", Enum.RenderPriority.Camera.Value + 1, function()
camera = Workspace.CurrentCamera
if not camera or not humanoid or humanoid.Health <= 0 then
return
end
-- Soleil : pas d'éblouissement lorsque le soleil est sous l'horizon.
local sunDirection = Lighting:GetSunDirection()
local lookingAtSun = camera.CFrame.LookVector:Dot(-sunDirection) >= CONFIG.SunLookDot
if lookingAtSun and sunIsAbovePlayer() then
task.spawn(triggerSunBlind)
end
-- Joueur regardé : assombrissement progressif + tremblement de caméra.
local targetPlayerEffect = lookingAtAnotherPlayer() and 1 or 0
playerEffect += (targetPlayerEffect - playerEffect) * 0.12
if not sunBlindActive then
color.Brightness = -CONFIG.PlayerDarkness * playerEffect
end
if playerEffect > 0.03 then
local strength = CONFIG.PlayerShake * playerEffect
local x = math.sin(time() * 17) * strength
local y = math.cos(time() * 23) * strength
camera.CFrame = camera.CFrame * CFrame.new(x, y, 0)
end
end)
print("UltraAtmosphereEffects chargé.")No comments yet for this script.



