I am trying to change some of the lighting properties whenever a value (currentmap) in replicated storage changes. the whole script runs but the brightness does not change. It is not a problem with the Brightness variable as i tried replacing the “Brightness.Value” with just a number and it still did not work.
The local script is in StarterPlayerScripts and i have already tried replacing game.Lighting with game:GetService(“Lighting”)
local Lighting = game.Lighting
local currentmap = game.ReplicatedStorage.CurrentMap
local currentlighting = game.ReplicatedStorage.CurrentLighting
local Brightness = currentlighting.Brightness
local function ChangeLighting()
task.wait(1)
Lighting.Brightness = Brightness.Value
print("Lighting correctly loaded")
end
currentmap.Changed:Connect(ChangeLighting)
It would help to know what some of the Console Output is printing out! It’s not a guarantee that everything in the client is going to load instantly, so it could be the possibility of things not loading in properly which may require some WaitForChild() yielding
It could also depend on what you have your currentlighting variable set as (Value Object, BasePart, etc) which may be halting progress if it’s not detecting for the rest of the script to run
local Lighting = game:GetService("Lighting")
local RS = game:GetService("ReplicatedStorage")
local currentmap = RS:WaitForChild("CurrentMap")
local currentlighting = RS:WaitForChild("CurrentLighting")
local Brightness = currentlighting.Brightness
local function ChangeLighting()
task.wait(1)
Lighting.Brightness = Brightness.Value
print("Lighting correctly loaded")
end
currentmap.Changed:Connect(ChangeLighting)
print("Just to make sure that the script actually works, this line should print")
Thank you! I’m not sure what the problem was exactly since the console didn’t have any error outputs, that’s why i didn’t mention any, but your solution worked so it’s probably one of the things you mentioned. Again, thanks for the help and for your time