Why my camera create a shadow?

Hello, I have a localscript in StarterPlayerScripts which allows you to create an underwater atmosphere, if I remove this script the shadow of the camera disappears, I don’t know what makes the shadow of the camera appear, any idea? THANKS.

local TouchPart = Instance.new("Part", workspace)
TouchPart.Anchored = true
TouchPart.CanCollide = false
TouchPart.Size = Vector3.new(1, 1, 1)


local Blur = Instance.new("BlurEffect", game.Lighting)
Blur.Enabled = false
Blur.Size = 8


local ColorCorrection = Instance.new("ColorCorrectionEffect", game.Lighting)
ColorCorrection.Enabled = false
ColorCorrection.TintColor = Color3.fromRGB(11, 143, 213)
ColorCorrection.Contrast = 0.5
ColorCorrection.Brightness = 0.5
ColorCorrection.Saturation = 0.1


local UnderwaterAmbienceSound = Instance.new("Sound", workspace.CurrentCamera)
UnderwaterAmbienceSound.Name = "UnderwaterAmbienceSound"
UnderwaterAmbienceSound.SoundId = "rbxassetid://4626145950"
if not UnderwaterAmbienceSound.IsLoaded then
	UnderwaterAmbienceSound.Loaded:Wait()
end
UnderwaterAmbienceSound.Volume = 0
UnderwaterAmbienceSound.Looped = true
UnderwaterAmbienceSound:Play()


local TouchConnection = TouchPart.Touched:Connect(function() end)
--TouchConnection:Disconnect()


game:GetService("RunService").RenderStepped:Connect(function()
	TouchPart.CFrame = workspace.CurrentCamera.CFrame
	local TouchingParts = TouchPart:GetTouchingParts()
	local WaterFound = false
	for _, Part in pairs(TouchingParts) do
		if Part.Name:find("Water") or Part.Parent.Name:find("Water") then
			WaterFound = true
			break
		end
	end
	if WaterFound then
		UnderwaterAmbienceSound.Volume = 0.5
		ColorCorrection.Enabled = true
		Blur.Enabled = true
	else
		UnderwaterAmbienceSound.Volume = 0
		ColorCorrection.Enabled = false
		Blur.Enabled = false
	end
end)
2 Likes

Try adding this line:

TouchPart.CastShadow = false

1 Like

Try this.

local TouchPart = Instance.new("Part", workspace)
TouchPart.Anchored = true
TouchPart.CanCollide = false
TouchPart.Size = Vector3.new(1, 1, 1)
TouchPart.CastShadow = false


local Blur = Instance.new("BlurEffect", game.Lighting)
Blur.Enabled = false
Blur.Size = 8


local ColorCorrection = Instance.new("ColorCorrectionEffect", game.Lighting)
ColorCorrection.Enabled = false
ColorCorrection.TintColor = Color3.fromRGB(11, 143, 213)
ColorCorrection.Contrast = 0.5
ColorCorrection.Brightness = 0.5
ColorCorrection.Saturation = 0.1


local UnderwaterAmbienceSound = Instance.new("Sound", workspace.CurrentCamera)
UnderwaterAmbienceSound.Name = "UnderwaterAmbienceSound"
UnderwaterAmbienceSound.SoundId = "rbxassetid://4626145950"
if not UnderwaterAmbienceSound.IsLoaded then
	UnderwaterAmbienceSound.Loaded:Wait()
end
UnderwaterAmbienceSound.Volume = 0
UnderwaterAmbienceSound.Looped = true
UnderwaterAmbienceSound:Play()


local TouchConnection = TouchPart.Touched:Connect(function() end)
--TouchConnection:Disconnect()


game:GetService("RunService").RenderStepped:Connect(function()
	TouchPart.CFrame = workspace.CurrentCamera.CFrame
	local TouchingParts = TouchPart:GetTouchingParts()
	local WaterFound = false
	for _, Part in pairs(TouchingParts) do
		if Part.Name:find("Water") or Part.Parent.Name:find("Water") then
			WaterFound = true
			break
		end
	end
	if WaterFound then
		UnderwaterAmbienceSound.Volume = 0.5
		ColorCorrection.Enabled = true
		Blur.Enabled = true
	else
		UnderwaterAmbienceSound.Volume = 0
		ColorCorrection.Enabled = false
		Blur.Enabled = false
	end
end)

Hope I helped :smile:

3 Likes

Thank you so much !!! it works :grin:

2 Likes

No problem. I’m happy i helped :smile:

1 Like

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