I’m making a script where if a player dies, it changes the ClockTime and other lighting things for the client. For some reason in my script, when the player dies, no lighting changes at all and there is no output error.
local Lighting = game:GetService("Lighting")
local Ambient = Lighting.Ambient
local OutdoorAmbient = Lighting.OutdoorAmbient
local FogColor = Lighting.FogColor
local FogEnd = Lighting.FogEnd
local FogStart = Lighting.FogStart
local Brightness = Lighting.Brightness
local ClockTime = Lighting.ClockTime --old settings for lighting pre-change
game.Lighting.ClockTime = 1
game.Lighting.Brightness = 0
game.Lighting.Ambient = Color3.new(0, 0, 0)
game.Lighting.OutdoorAmbient = Color3.new(0, 0, 0)
game.Lighting.FogStart = 0
game.Lighting.FogEnd = 20
game.Lighting.FogColor = Color3.new(0, 0, 0) --changes lighting settings
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild('Humanoid').Died:Connect(function()
ClockTime = ClockTime
Ambient = Ambient
OutdoorAmbient = OutdoorAmbient
FogEnd = FogEnd
FogStart = FogStart
FogColor = FogColor
Brightness = Brightness
script:Destroy() --on death what should be happening is it goes back to the old settings
end)
end)
end)
This is on a LocalScript in PlayerGui. I’ve tried to make the values for the bottom third part numbers rather than variables like “ClockTime” but nothing happened at all, still not even anything in the output.