Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Filtering Enabled] Hiding Other Players, contains glitches. Any help?

Okay this script has had problems before, with not working, but I fixed main issues, by removes the parts where it makes the face decal transparent and same with root parts.

That may have made the script work great but however I don't like seeing the face of someone when then are suppose to be invisible, and when I turn then visible again, I don't want to see their root part.

The other thing is the only major glitch I have encountered. If a player dies, this script will not connect this player again until you have died and reset the script. So if a player resets and the script of the player says that player should be invisible, they wont be. Could there be a way of using a function to detect when a player dies, rather than using a while true do.

[Okay I found a way to counter the glitch above, I have a small while true do script in the player that waits for the player's health to equal 0. When this happens it Fires a ServerEvent when ALSO fixes the players camera (Just in case they are viewing a cutscene) and it clones a script into the player's playergui that does what the script does below then removes itself.]

Here is the script:

local player = game.Players.LocalPlayer
local char = player.Character
wait(3)

if player.PlayerService.PlayerTeam.Value == BrickColor.new("White") then
	wait(1)
	for i, v in pairs(game.Players:GetChildren()) do
		if v.Name == player.Name then
			wait()
		elseif v:IsA'Player' then
			for p, t in pairs (v.Character:GetChildren()) do
				if t.Name == "HumanoidRootPart" then
					wait()
				elseif t.Name == "Head" then
					t.Transparency = 1
					t.face.Transparency = 1
				elseif t:IsA'Part' then
				t.Transparency = 1
				elseif t:IsA'Hat' then
					t.Handle.Transparency = 1
				end
			end
		end
	end
end
	
game.Players.PlayerAdded:connect(function (newPlayer)
	wait(1)
if player.PlayerService.PlayerTeam.Value == BrickColor.new("White") then
		for i, v in pairs(game.Players:GetChildren()) do
			if v.Name == player.Name then
				wait()
			elseif v:IsA'Player' then
				for p, t in pairs (v.Character:GetChildren()) do
				if t.Name == "HumanoidRootPart" then
					wait()
				elseif t.Name == "Head" then
					t.Transparency = 1
					t.face.Transparency = 1
				elseif t:IsA'Part' then
				t.Transparency = 1
				elseif t:IsA'Hat' then
					t.Handle.Transparency = 1
					end
				end
			end
		end
	end					
end)

player.PlayerService.PlayerTeam.changed:connect(function(val)
	wait(1)
	if val == BrickColor.new("White") then
		for i, v in pairs(game.Players:GetChildren()) do
			if v.Name == player.Name then
				wait()
			elseif v:IsA'Player' then
				for p, t in pairs (v.Character:GetChildren()) do
				if t.Name == "HumanoidRootPart" then
					wait()
				elseif t.Name == "Head" then
					t.Transparency = 1
					t.face.Transparency = 1
				elseif t:IsA'Part' then
				t.Transparency = 1
				elseif t:IsA'Hat' then
					t.Handle.Transparency = 1
					end
				end
			end
		end
	end	
	if val == BrickColor.new("Bright red") then
		for i, v in pairs(game.Players:GetChildren()) do
			if v.Name == player.Name then
				wait()
			elseif v:IsA'Player' then
				for p, t in pairs (v.Character:GetChildren()) do
				if t.Name == "HumanoidRootPart" then
					wait()
				elseif t.Name == "Head" then
					t.Transparency = 0.9
					t.face.Transparency = 1
				elseif t:IsA'Part' then
				t.Transparency = 0.9
				elseif t:IsA'Hat' then
					t.Handle.Transparency = 0.9
					end
				end
			end
		end
	end	
	if val == BrickColor.new("Medium stone grey") then
		for i, v in pairs(game.Players:GetChildren()) do
			if v.Name == player.Name then
				wait()
			elseif v:IsA'Player' then
				for p, t in pairs (v.Character:GetChildren()) do
					if t.Name == "HumanoidRootPart" then
					wait()
				elseif t.Name == "Head" then
					t.Transparency = 0
					t.face.Transparency = 0
				elseif t:IsA'Part' then
				t.Transparency = 0
				elseif t:IsA'Hat' then
					t.Handle.Transparency = 0
					end
				end
			end
		end
	end							
end)

1 comment

0

use Humanoid.Died to do something when the humanoid dies.

1 answer

✓ Accepted answer

For the HumanoidRootPart and Face issues, In your for loop that makes the player visible or invisible, set it to check if the name of the part is HumanoidRootPart, in which case it doesnt do anything. For the face, check if v.Name is Head, and you can access the face then.

3 comments

0

okay ill take a look at it

0

Id like you to take a look at my revised script, hope that is what you are talking about.

0

Seems to work 100% tried it with two of my friend in a server. Now i just have to find out of to change the body colors correctly.

This discussion is preserved as it was. New answers, comments, and votes are closed.