write me a lua script for roblox that adds a thick black fog
- User
write me a lua script for roblox that adds a thick black fog
- Assistant
local FogColor = Color3.fromRGB(0,0,0) -- Change the color of the fog here. local FogDensity = 0.7 -- Change the density of the fog here.
game:GetService("Lighting").FogColor = FogColor game:GetService("Lighting").FogEnd = 100000 -- Change the distance of the fog here. game:GetService("Lighting").FogStart = 0 game:GetService("Lighting").FogDensity = FogDensity
workspace.FogAttachment = Instance.new("Attachment", workspace.Terrain) workspace.FogAttachment.Position = Vector3.new(0, 10000, 0) workspace.FogAttachment.Name = "FogAttachment"
game:GetService("RunService").RenderStepped:Connect(function() workspace.FogAttachment.Position = game.Players.LocalPlayer.Character.Head.Position - Vector3.new(0, -5, 0) end)
for _, item in pairs(workspace:GetDescendants()) do if item:IsA("BasePart") then local Fog = Instance.new("Part") Fog.Parent = item Fog.Transparency = 0.95 Fog.Size = Vector3.new(100, 100, 100) --Change the size of the fog here. Fog.Anchored = true Fog.CanCollide = false Fog.Locked = true Fog.Material = Enum.Material.SmoothPlastic Fog.Color = FogColor Fog.Name = "Fog"
local FogMesh = Instance.new("SpecialMesh") FogMesh.Parent = Fog FogMesh.MeshType = Enum.MeshType.Sphere FogMesh.Scale = Vector3.new(10, 10, 10) --Change the scale of the fog here. endend