How do you disable shadows on the player?

I have a script that makes a PointLight that has shadows enabled spawn inside the players HumanoidRootPart, but the shadows show the players accessories, arms, legs, etc. I need the player accessories, etc, to have CastShadow disabled when they spawn.

Here is an example of what I’m talking about.
robloxapp-20201103-1829349.wmv (224.1 KB)
(Sorry for the bad quality, its recorded on the studio video recorder.)
What I need it to look like is this.
robloxapp-20201103-1829349.wmv (224.1 KB)

2 Likes
local Players = game:GetService("Players")

local function onCharAdded(char)
    for i, v in ipairs(char:GetDescendants()) do
        if v:IsA("BasePart") then
             v.CastShadow = false
        end
    end
end

local function onPlrAdded(plr)
    charAddConns[plr] = plr.CharacterAdded:Connect(onCharAdded)
end

local function onPlrRemoving(plr)
    charAddConn[plr]:Disconnect()
    charAddConns[plr] = nil
end

Players.PlayerAdded:Connect(onPlrAdded)
Players.PlayerRemoving:Connect(onPlrRemoving)
2 Likes

It says charAddConn is an unknown global

Try:

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        for _, v in pairs(Character:GetChildren()) do
              if v:IsA("BasePart") then
                  v.CastShadow = false
             end
        end
    end
end
1 Like

Doesn’t work either, still shows the shadows.

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        for _, v in pairs(Character:GetChildren()) do
              if v:IsA("MeshPart") then
                  v.CastShadow = false
             end
        end
    end
end

Thy this. I changed it to MeshPart.

1 Like

Still doesn’t work for some reason.

CharacterAppearanceLoaded waits for all objects to load into the character iirc. But yeh, you simply have to for loop through the character’s children.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function(character)
		for i , v in pairs(character:GetDescendants()) do
			if v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("MeshPart") then
				v.CastShadow = false
			end
		end
	end)
end)
9 Likes

Stupid question, but where do I put this script, and do I put it in a LocalScript or a script?

1 Like

Best suitable in the server(ServerScriptService)

2 Likes

Understand this that Local Script is only on the clients side but a Server Script is in the whole server for every player. So if you do this in a local script it will only be on the client that this works i.e only for you your shadow is invisible but other players can see it but if you put this in a server script it will be server wide so then no body can see any other persons shadow.

Hope You learn Something from this :smiley:

2 Likes

For some reason, this script doesn’t work anymore?

3 Likes

There is still a shadow dot left even after turning off shadow on all the body parts