I was Replicating the Legacy Lighting and i have One Big Issue the mesh not blockmesh or special mesh, dosent effect “ParticalShadow”
My full Script for Legacy Lighting
Full Script
local LastShadow = game.Lighting.GlobalShadows
local FogIgnore = false
local Ignore = false
local ExcludeTransparent = false
local Deferred = false – Must be set depending on workspace.SignalBehavior value
local function AdjustColor(Color)
local H, S, V = Color:ToHSV()
return Color3.fromHSV(H, math.clamp(S / (2 - (0.75 * V)), 0, 1), math.clamp(V ^ (0.59 + V / 1.41) + 4 / 255, 0, 205 / 255))
end
local function adjust(v)
if v:HasTag(“Ignore_Legacy”) then return end
if v:IsA(“BasePart”) then
local bool = false
local connect
local originalcolor = v.Color
if v.Material == Enum.Material.Neon then
v.Color = AdjustColor(v.Color)
connect = v:GetPropertyChangedSignal(“Color”):Connect(function()
if v.Material == Enum.Material.Neon then
if not bool then
originalcolor = v.Color
bool = true
v.Color = AdjustColor(v.Color)
if Deferred then
task.defer(function() bool = false end)
else
bool = false
end
end
else
connect:Disconnect()
v.Color = originalcolor
end
end)
end
v:GetPropertyChangedSignal(“Material”):Connect(function()
if v.Material == Enum.Material.Neon then
v.Color = AdjustColor(v.Color)
else
if connect then connect:Disconnect() end
v.Color = originalcolor
end
end)
elseif v.ClassName:find(“Light”) then
v.Brightness = math.min(v.Brightness, 1.5)
v.Brightness /= 2 * 1 / v.Brightness
v.Range -= 4 * v.Range / 60
if v:IsA(“SpotLight”) then
v.Angle *= 0.75
end
local Light = v:Clone()
Light.Range /= 2
if Light:IsA(“SurfaceLight”) then
Light.Angle /= 2
end
Light:AddTag(“Ignore_Legacy”)
Light.Parent = v.Parent
end
end
local function AdjustLighting(Ambient)
if not Ignore then
Ignore = true
if not Ambient then
game.Lighting:SetAttribute(“Brightness”, game.Lighting.Brightness)
end
local Brightness
local H, S, V = game.Lighting.Ambient:ToHSV()
local OH, OS, OV = game.Lighting.OutdoorAmbient:ToHSV()
Brightness = math.max(V, OV)
Brightness = math.clamp(Brightness, 32 / 255, 1)
if (not game.Lighting.GlobalShadows and LastShadow) or (not game.Lighting.GlobalShadows and not LastShadow) then
Brightness = V
Brightness = math.clamp(Brightness, 32 / 255, 1)
game.Lighting:SetAttribute(“OutdoorAmbient”, game.Lighting.OutdoorAmbient)
game.Lighting.OutdoorAmbient = Color3.new(0, 0, 0)
elseif game.Lighting.GlobalShadows and not LastShadow then
if game.Lighting:GetAttribute(“OutdoorAmbient”) then
game.Lighting.OutdoorAmbient = game.Lighting:GetAttribute(“OutdoorAmbient”)
OH, OS, OV = game.Lighting.OutdoorAmbient:ToHSV()
Brightness = math.max(V, OV)
Brightness = math.clamp(Brightness, 32 / 255, 1)
end
end
if not game.Lighting:GetAttribute(“Brightness”) then
game.Lighting:SetAttribute(“Brightness”, game.Lighting.Brightness)
end
game.Lighting.Brightness = game.Lighting:GetAttribute(“Brightness”) * Brightness * 4
LastShadow = game.Lighting.GlobalShadows
if Deferred then
task.defer(function() Ignore = false end)
else
Ignore = false
end
end
end
local function AdjustFog(Color)
if not FogIgnore then
FogIgnore = true
local H, S, Brightness = game.Lighting.FogColor:ToHSV()
Brightness = math.max(Brightness * 4, 1)
if not Color then
game.Lighting:SetAttribute(“FogEnd”, game.Lighting.FogEnd)
end
if not game.Lighting:GetAttribute(“FogEnd”) then
game.Lighting:SetAttribute(“FogEnd”, game.Lighting.FogEnd)
end
game.Lighting.FogEnd = game.Lighting:GetAttribute(“FogEnd”) * Brightness
if Deferred then
task.defer(function() FogIgnore = false end)
else
FogIgnore = false
end
end
end
local function ShadowFix(Part)
if Part.Name == “PartialShadow” then return end
if Part:IsA(“BasePart”) and not Part:IsA(“MeshPart”) and not Part:IsA(“UnionOperation”) and not Part:IsA(“TrussPart”) then
if Part.CastShadow then
if Part.Size.X < 4 or Part.Size.Y < 4 or Part.Size.Z < 4 then
if Part.Transparency == 0 then
if not Part.Anchored or Part:FindFirstChildWhichIsA(“FileMesh”) then return end
local Thickness = math.min(Part.Size.X, Part.Size.Y, Part.Size.Z)
local Weld = Instance.new(“WeldConstraint”)
local NewPart = Part:Clone()
NewPart.Name = “PartialShadow”
NewPart.Transparency = math.min(1 - Thickness / 6 - 0.08, 0.7)
NewPart.CanCollide = false
NewPart.CanQuery = false
NewPart.CanTouch = false
NewPart.Anchored = false
NewPart.Massless = true
NewPart.Material = Enum.Material.SmoothPlastic
NewPart:ClearAllChildren()
if (Part:IsA("Part") and Part.Shape == Enum.PartType.Wedge) or Part:IsA("WedgePart") then
NewPart.CFrame *= CFrame.new(0, -0.0125, 0.0125)
NewPart.Size = Vector3.new(NewPart.Size.X - 0.05, NewPart.Size.Y * 0.99, NewPart.Size.Z * 0.99)
elseif (Part:IsA("Part") and Part.Shape == Enum.PartType.CornerWedge) or Part:IsA("CornerWedgePart") then
NewPart.CFrame *= CFrame.new(0.0125, -0.0125, -0.0125)
NewPart.Size *= Vector3.one * 0.975
else
NewPart.Size -= Vector3.one * 0.05
end
Weld.Part0 = Part
Weld.Part1 = NewPart
Weld.Name = "ShadowHold"
Weld.Parent = Part
NewPart.Parent = Part
Part.CastShadow = false
elseif ExcludeTransparent then
Part.CastShadow = false
end
end
end
end
end
for _, v in pairs(workspace:GetDescendants()) do
adjust(v)
ShadowFix(v)
end
AdjustLighting()
AdjustFog()
workspace.DescendantAdded:Connect(function(Object)
adjust(Object)
ShadowFix(Object)
end)
game.Lighting:GetPropertyChangedSignal(“Brightness”):Connect(AdjustLighting)
game.Lighting:GetPropertyChangedSignal(“Ambient”):Connect(function() AdjustLighting(true) end)
game.Lighting:GetPropertyChangedSignal(“OutdoorAmbient”):Connect(function() AdjustLighting(true) end)
game.Lighting:GetPropertyChangedSignal(“GlobalShadows”):Connect(function() AdjustLighting(true) end)
game.Lighting:GetPropertyChangedSignal(“FogEnd”):Connect(AdjustFog)
game.Lighting:GetPropertyChangedSignal(“FogColor”):Connect(function() AdjustFog(true) end)
for _, light in ipairs(game:GetDescendants()) do
if light:IsA(“Light”) then
if light.Brightness >= 1.01 then
light.Brightness = 1.0
end
end
end