Thank you for the update. It seems that the server is detecting when a player touches the bloody biome, but the client-side lighting changes are not being applied. Let's focus on debugging the client-side script and ensure that the lighting changes are being executed correctly.
Here's an updated version of the client-side script with more detailed debugging:
-- LocalScript (BiomeLightingHandler)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lighting = game:GetService("Lighting")
local SkyboxChangeEvent = ReplicatedStorage:WaitForChild("SkyboxChangeEvent")
local function onSkyboxChange(isBloody)
print("SkyboxChangeEvent received:", isBloody)
if isBloody then
-- Set bloody skybox and atmosphere
print("Setting Bloody atmosphere")
Lighting.Ambient = Color3.new(1, 0, 0)
print("Ambient set to:", Lighting.Ambient)
Lighting.OutdoorAmbient = Color3.new(1, 0, 0)
print("OutdoorAmbient set to:", Lighting.OutdoorAmbient)
Lighting.ColorShift_Bottom = Color3.new(1, 0, 0)
print("ColorShift_Bottom set to:", Lighting.ColorShift_Bottom)
Lighting.ColorShift_Top = Color3.new(1, 0, 0)
print("ColorShift_Top set to:", Lighting.ColorShift_Top)
-- Add a red atmosphere
local atmosphere = Lighting:FindFirstChild("Atmosphere") or Instance.new("Atmosphere")
atmosphere.Parent = Lighting
atmosphere.Density = 0.5
atmosphere.Color = Color3.new(1, 0, 0)
print("Atmosphere added and set to red")
-- Change sky color
local sky = Lighting:FindFirstChild("Sky") or Instance.new("Sky")
sky.Parent = Lighting
sky.SkyboxBk = "rbxassetid://6444884337" -- Red skybox
sky.SkyboxDn = "rbxassetid://6444884785"
sky.SkyboxFt = "rbxassetid://6444884337"
sky.SkyboxLf = "rbxassetid://6444884337"
sky.SkyboxRt = "rbxassetid://6444884337"
sky.SkyboxUp = "rbxassetid://6444884785"
print("Sky changed to red skybox")
else
-- Set normal skybox and atmosphere
print("Setting normal atmosphere")
Lighting.Ambient = Color3.new(0.5, 0.5, 0.5)
print("Ambient set to:", Lighting.Ambient)
Lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
print("OutdoorAmbient set to:", Lighting.OutdoorAmbient)
Lighting.ColorShift_Bottom = Color3.new(0, 0, 0)
print("ColorShift_Bottom set to:", Lighting.ColorShift_Bottom)
Lighting.ColorShift_Top = Color3.new(0, 0, 0)
print("ColorShift_Top set to:", Lighting.ColorShift_Top)
-- Remove atmosphere
local atmosphere = Lighting:FindFirstChild("Atmosphere")
if atmosphere then
atmosphere:Destroy()
print("Atmosphere removed")
end
-- Reset sky color
local sky = Lighting:FindFirstChild("Sky")
if sky then
sky.SkyboxBk = "rbxassetid://6444884337" -- Default skybox
sky.SkyboxDn = "rbxassetid://6444884785"
sky.SkyboxFt = "rbxassetid://6444884337"
sky.SkyboxLf = "rbxassetid://6444884337"
sky.SkyboxRt = "rbxassetid://6444884337"
sky.SkyboxUp = "rbxassetid://6444884785"
print("Sky reset to default skybox")
end
end
print("Lighting changes applied")
end
SkyboxChangeEvent.OnClientEvent:Connect(onSkyboxChange)
print("BiomeLightingHandler script loaded and connected to SkyboxChangeEvent")
-- Test the lighting changes
local function testLightingChanges()
print("Testing lighting changes")
onSkyboxChange(true) -- Test bloody biome
wait(5)
onSkyboxChange(false) -- Test normal biome
end
-- Uncomment the line below to test lighting changes when the script loads
-- testLightingChanges()
SkyboxChangeEvent.OnClientEvent:Connect(function(isBloody)
wait(0.1) -- Small delay
onSkyboxChange(isBloody)
end)
If you're still experiencing issues after implementing these changes, please provide the following information:
This additional information will help us pinpoint where the problem is occurring in the script execution.