Changing Lighting on the client doesnt work

I want to create a menu scene, that can only be seen on the client by using ReplicatedFirst without the character loading in, but changing the lighting doesn’t work for some reason

LocalScript
local Services = require(game:GetService("ReplicatedFirst").Modules.ServicesModule)
local SpawnModule = require(Services.ReplicatedFirst.Modules.MenuSpawnModule)
local LightingModule = require(Services.ReplicatedFirst.Modules.MenuLightingModule)
local CameraModule = require(Services.ReplicatedFirst.Modules.MenuCameraModule)

SpawnModule:SpawnMenu(Services.ReplicatedFirst.MenuObjects, Services.ReplicatedFirst.Terrain.Clouds)
LightingModule:SetupLighting(Services.Lighting)
CameraModule:SetupCamera(Services.Workspace.CurrentCamera, Services.Workspace.MenuObjects.menuCamera, Services.Players.LocalPlayer:GetMouse())

LightingModule
local MenuLightingModule = {}

local Services = require(game:GetService("ReplicatedFirst").Modules.ServicesModule)

function MenuLightingModule:SetupLighting(Lighting: Lighting)
	Lighting.Ambient = Color3.fromRGB(0, 0, 127)
	Lighting.Brightness = 1.5
	Lighting.ColorShift_Bottom = Color3.fromRGB(0, 0, 127)
	Lighting.ColorShift_Top = Color3.fromRGB(0, 170, 255)
	Lighting.EnvironmentDiffuseScale = 0
	Lighting.EnvironmentSpecularScale = 1
	Lighting.GlobalShadows = true
	--Lighting.LightingStyle = Enum.LightingStyle.Realistic
	Lighting.OutdoorAmbient = Color3.fromRGB(0, 0, 127)
	--Lighting.PrioritizeLightingQuality = true
	Lighting.ShadowSoftness = 0.2
	Lighting.GeographicLatitude = -26.283
	Lighting.TimeOfDay = "20:03:46"
	Lighting.ExposureCompensation = 0
	Lighting.ClockTime = 20.063
end

function MenuLightingModule:RevertLighting(Lighting: Lighting)
	Lighting.Ambient = Color3.fromRGB(70, 70, 70)
	Lighting.Brightness = 3
	Lighting.ColorShift_Bottom = Color3.fromRGB(0, 0, 0)
	Lighting.ColorShift_Top = Color3.fromRGB(0, 0, 0)
	Lighting.EnvironmentDiffuseScale = 1
	Lighting.EnvironmentSpecularScale = 1
	Lighting.GlobalShadows = true
	--Lighting.LightingStyle = Enum.LightingStyle.Realistic
	Lighting.OutdoorAmbient = Color3.fromRGB(70, 70, 70)
	--Lighting.PrioritizeLightingQuality = true
	Lighting.ShadowSoftness = 0.2
	Lighting.GeographicLatitude = 0
	Lighting.TimeOfDay = "14:30:00"
	Lighting.ExposureCompensation = 0
	Lighting.ClockTime = 14.5
end

return MenuLightingModule

Services Module is a giant table of game:GetService(“WhateverService”)

Hey! Seems your issue is that you’re not waiting for the player to load in completely. You can add repeat task.wait() until game:IsLoaded() at the top of your LocalScript, this should fix it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.