This commit is contained in:
listik committed 2026-11-16 23:50:40 +03:00
commit 2d6a8a867d
1093 files changed
+2424571

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
-- Snowfall (LocalScript, StarterPlayerScripts): light snowfall for atmosphere, only on the client.
-- An invisible flat part hangs above the camera and follows it; its ParticleEmitter drops soft flakes into the
-- world (the flakes are not locked to the part, so they stay where they are while the camera moves).
-- A slow, changing wind makes the flakes drift. Fewer flakes on phones.
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local AREA = 90 -- studs: size of the snowing square around the camera
local HEIGHT = 30 -- studs above the camera where the flakes appear
local RATE = UIS.TouchEnabled and not UIS.KeyboardEnabled and 160 or 300 -- flakes per second ("небольшой" снегопад)
local cloud = Instance.new("Part")
cloud.Name = "SnowCloud"
cloud.Anchored, cloud.CanCollide, cloud.CanQuery, cloud.CanTouch, cloud.CastShadow = true, false, false, false, false
cloud.Transparency = 1
cloud.Size = Vector3.new(AREA, 1, AREA)
local snow = Instance.new("ParticleEmitter")
snow.Name = "Snow"
snow.Texture = "rbxasset://textures/particles/sparkles_main.dds" -- built-in white star = snowflake
snow.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
snow.LightEmission = 0.35
snow.LightInfluence = 0.4 -- night map: a bit of own glow, so the flakes are visible but not neon
snow.Size = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0.4, 0.12),
NumberSequenceKeypoint.new(1, 0.4, 0.12),
})
snow.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 1),
NumberSequenceKeypoint.new(0.08, 0.15),
NumberSequenceKeypoint.new(0.85, 0.15),
NumberSequenceKeypoint.new(1, 1),
})
snow.EmissionDirection = Enum.NormalId.Bottom
snow.Shape = Enum.ParticleEmitterShape.Box
snow.ShapeStyle = Enum.ParticleEmitterShapeStyle.Volume
snow.Speed = NumberRange.new(4, 7)
snow.SpreadAngle = Vector2.new(12, 12)
snow.Lifetime = NumberRange.new(9, 12)
snow.Rotation = NumberRange.new(0, 360)
snow.RotSpeed = NumberRange.new(-40, 40)
snow.Drag = 0 -- no drag: with drag the flakes stop and hang up at the cloud
snow.Rate = RATE
snow.LockedToPart = false
snow.Parent = cloud
cloud.Parent = workspace.CurrentCamera or workspace
-- follow the camera (flat, ignore its rotation) + slow changing wind
RunService.RenderStepped:Connect(function()
local cam = workspace.CurrentCamera
if not cam then return end
if cloud.Parent ~= cam then cloud.Parent = cam end
local p = cam.CFrame.Position
cloud.CFrame = CFrame.new(p.X, p.Y + HEIGHT, p.Z)
local t = os.clock()
snow.Acceleration = Vector3.new(1.2 * math.sin(t * 0.11) + 0.5 * math.sin(t * 0.37), 0, 0.9 * math.cos(t * 0.09) + 0.4 * math.sin(t * 0.29))
end)