local Light = game:GetService("Lighting")
local atmo = Instance.new("Atmosphere")
if Light:FindFirstChild("Atmosphere") then
return
end
atmo.Parent = Light
Light.Atmosphere.Color = Color3.fromRGB(255, 255, 255)
Light.Atmosphere.Decay = Color3.fromRGB(5, 58, 122)
end
game.Workspace.OceanBackgroundEffect.Touched:Connect(OceanEffect)```
#I made this script and theres a error, It says Instance is not a valid member of Lighting "Lighting"
41 messages · Page 1 of 1 (latest)
would this work I tried not to completely copy your code function OceanEffect()
local light = game:GetService("Lighting")
local Atmosphere = game.Workspace.Instance.new("Atmosphere")
Atmosphere.Color = Color3.fromRGB(255, 255, 255)
Atmosphere.Decay = Color3.fromRGB(5, 58, 122)
Atmosphere.Glare = 10
Atmosphere.Haze = 10
Atmosphere.Parent = light
if light.FindFirstChild("Atmosphere") then return
end
end
game.Workspace.OceanBackgroundEffect.Touched:Connect(OceanEffect)
this means that you cant make 1000x from touching the OceanBackGround Part right if light.FindFirstChild("Atmosphere") then return
end
yes
but
you should put that above
local Atmosphere
so it doesnt even create it if its already there
if light.FindFirstChild("Atmosphere") then return
this? function OceanEffect()
local light = game:GetService("Lighting")
if light.FindFirstChild("Atmosphere") then return
end
local Atmosphere = game.Workspace.Instance.new("Atmosphere")
Atmosphere.Color = Color3.fromRGB(255, 255, 255)
Atmosphere.Decay = Color3.fromRGB(5, 58, 122)
Atmosphere.Glare = 10
Atmosphere.Haze = 10
Atmosphere.Parent = light
if light.FindFirstChild("Atmosphere") then return
end
end
game.Workspace.OceanBackgroundEffect.Touched:Connect(OceanEffect)
** You are now Level 1! **
I forgot ro but I did
local light = game:GetService("Lighting")
if light.FindFirstChild("Atmosphere") then return
end
local Atmosphere = game.Workspace.Instance.new("Atmosphere")
Atmosphere.Color = Color3.fromRGB(255, 255, 255)
Atmosphere.Decay = Color3.fromRGB(5, 58, 122)
Atmosphere.Glare = 10
Atmosphere.Haze = 10
Atmosphere.Parent = light
end
game.Workspace.OceanBackgroundEffect.Touched:Connect(OceanEffect)```
that should only make 1
yea it look like that exactly I think
I got a question, so why can I do light.Instance.new("Atmosphere") like I did on my old script
you mightve had another atmosphere already
idk why but its much better to make it organized
like make
local atmo = Instance.new("Atmosphere")
I did have another atmosphere so I could copy the values and I think i ran it with it
ill check later
the code is inside the OceanBackground Part should it be in workspace or somewhere else?
workspace is fine, or serverscriptservice
on this line of code the .new in front of the Instance is a different color and a error saying instance isnt a valid member of workspace how do i fix this local Atmosphere = game.Workspace.Instance.new("Atmosphere")
just do
local Atmosphere = Instance.new("Atmosphere")
as long as you define it its fine
thats probably why its erroring
oh and you define the Varibles parent here Atmosphere.Parent = light
Its working now
and I think I learnt why it was changing the .news color
because I put game.Workspace.Instance.new it put Instance as a Instance inside Workspace but ebcause it couldnt find it it error.
Thank you for your help it works now