Shadow Mode: Anonymous Moderating Tool

The player does not die, it just teleports back, It takes away the sword, but duplicates the admin tools

1 Like

Huh, I don’t know why that is happening. The code only creates new tools when the character spawns:

local setShadowMode = require(script.SetShadowMode)
local isAdmin = require(script.IsAdmin)

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	if isAdmin(player) then
		local isShadow = false
		setShadowMode(player, isShadow)
		
		player.CharacterAdded:Connect(function(character)
			-- (Creates shadow toggle tool)
			
			-- (Creates disguise toggle tool)

			-- (Creates invisible toggle tool)

			-- (Creates speed toggle tool)
		end)
	end
end)
Full Code
local setShadowMode = require(script.SetShadowMode)
local isAdmin = require(script.IsAdmin)

local Players = game:GetService("Players")

-- Example code.
-- Gives admins shadow toggle tool, disguise toggle tool, invisible toggle tool, and speed toggle tool.
-- This is mostly for demostration. You probably want to add these to your admin commands if this works well for you.
Players.PlayerAdded:Connect(function(player)
	if isAdmin(player) then
		local isShadow = false
		setShadowMode(player, isShadow)
		
		player.CharacterAdded:Connect(function(character)
			local shadowToggleTool = Instance.new("Tool")
			shadowToggleTool.RequiresHandle = false
			shadowToggleTool.Name = "Shadow Mode: "..(isShadow and "ON" or "OFF")
			shadowToggleTool.ToolTip = "Toggle Shadow Mode"
			shadowToggleTool.Activated:Connect(function()
				isShadow = not isShadow
				setShadowMode(player, isShadow)
				shadowToggleTool.Name = "Shadow Mode: "..(isShadow and "ON" or "OFF")
			end)
			shadowToggleTool.Parent = player.Backpack
			
			local disguiseUserIds = {
				1; -- Roblox
				2; -- Joe Doe
				3; -- Jane Doe
			}
			
			local disguiseDescriptions = {}
			do
				for index, userId in ipairs(disguiseUserIds) do
					disguiseDescriptions[index] = Players:GetHumanoidDescriptionFromUserId(userId)
				end
			end
			
			local userId = math.clamp(player.UserId, 1, math.huge)
			
			local playerDescription = Players:GetHumanoidDescriptionFromUserId(userId)
			
			local isDisguise = false
			local disguiseToggleTool = Instance.new("Tool")
			disguiseToggleTool.RequiresHandle = false
			disguiseToggleTool.Name = "Disguise Mode: "..(isDisguise and "ON" or "OFF")
			disguiseToggleTool.ToolTip = "Toggle Disguise Mode"
			disguiseToggleTool.Activated:Connect(function()
				local humanoid = character:FindFirstChild("Humanoid")
				if humanoid then
					if isDisguise then
						humanoid:ApplyDescription(playerDescription)
					else
						humanoid:ApplyDescription(disguiseDescriptions[math.random(1, #disguiseDescriptions)])
					end
					
					isDisguise = not isDisguise
					disguiseToggleTool.Name = "Disguise Mode: "..(isDisguise and "ON" or "OFF")
				end
			end)
			disguiseToggleTool.Parent = player.Backpack 
			
			local isInvisible = false
			local uninvisibleBindable = nil
			
			local invisibleToggleTool = Instance.new("Tool")
			invisibleToggleTool.RequiresHandle = false
			invisibleToggleTool.Name = "Invisible Mode: "..(isInvisible and "ON" or "OFF")
			invisibleToggleTool.ToolTip = "Toggle Invisible Mode"
			invisibleToggleTool.Activated:Connect(function()
				if isInvisible then
					uninvisibleBindable:Fire()
					uninvisibleBindable:Destroy()
				else
					uninvisibleBindable = Instance.new("BindableEvent")
					local event = uninvisibleBindable.Event
					
					local tool = character:FindFirstChildOfClass("Tool")
					
					for _, descendant in ipairs(character:GetDescendants()) do
						if tool and descendant:IsDescendantOf(tool) then
							continue
						end
						
						if descendant:IsA("BasePart") or descendant:IsA("Decal") then
							local oldTransparency = descendant.Transparency
							descendant.Transparency = 1
							event:Connect(function()
								descendant.Transparency = oldTransparency
							end)
						elseif descendant:IsA("ParticleEmitter") then
							local oldEnabled = descendant.Enabled
							descendant.Enabled = false
							event:Connect(function()
								descendant.Enabled = oldEnabled
							end)
						end
					end
				end
				
				isInvisible = not isInvisible
				invisibleToggleTool.Name = "Invisible Mode: "..(isInvisible and "ON" or "OFF")
			end)
			invisibleToggleTool.Parent = player.Backpack 
			
			
			local isSpeed = false
			local increaseFactor = 6
			local speedToggleTool = Instance.new("Tool")
			speedToggleTool.RequiresHandle = false
			speedToggleTool.Name = "Speed Mode: "..(isSpeed and "ON" or "OFF")
			speedToggleTool.ToolTip = "Toggle Speed Mode"
			speedToggleTool.Activated:Connect(function()
				local humanoid = character:FindFirstChild("Humanoid")
				if humanoid then
					if isSpeed then
						humanoid.WalkSpeed /= increaseFactor
						humanoid.JumpPower /= math.sqrt(increaseFactor)
						humanoid.JumpHeight /= increaseFactor
					else
						humanoid.WalkSpeed *= increaseFactor
						humanoid.JumpPower *= math.sqrt(increaseFactor)
						humanoid.JumpHeight *= increaseFactor
					end

					isSpeed = not isSpeed
					speedToggleTool.Name = "Speed Mode: "..(isSpeed and "ON" or "OFF")
				end
			end)
			speedToggleTool.Parent = player.Backpack
		end)
	end
end)

You should turn this into a gui instead of some tools. Also GitHub repository if you can so mobile users who can’t access their computers at the time can read the code.

1 Like

Amazing resource! Very smart about hiding admin from the player list.

This is something that my moderation team has been waiting for, and I appreciate that you made this for communities needing shadow mode for their staff members.

1 Like

Its ok, I can still make it work
My solution was to make myself have the ability to remove tools

1 Like

I took your advice and made a GUI based version:

It’s basically the same thing but with GUI:

Credit to ForeverHD and his TopbarPlus module.


@Coolsbloxian If the tools are still being wonky you might want to check out the GUI based version.

3 Likes

This is what I needed :slight_smile: thank you

1 Like

This does solve my problem
AND it looks so much better, thanks

1 Like

how do i set this up? is there a video to set it up or something?

1 Like

Just put the model folder into the workspace

1 Like

I have recently used this system in my hangout game (with friends) and it actually works but for one small detail. It still says Your friend has joined the server. Is it possible for you to remove them for admins? (I’m not experienced in using Roblox CoreUI so I dont know)

1 Like

Wouldn’t advise to use player.Parent = nil, bad usage and may break certain game features

1 Like

it isn’t working i put it in workspace

1 Like

Generally it works fine. I haven’t found any code that gets broken because of it, though if you find any I would like to know.

You can remove that by following this post:

Doing that just removes system messages.

You just need to insert the model into Workspace like Drew said.

1 Like

Are you trying to use the tool based one or the GUI based one?

1 Like

no i trying to use the gui one

For the GUI based on I have a feature idea. You can spaw in a UI (Using one of the top buttons) that allows you to add people to this mode (who are in server) without being on admin list. Helpful for special visitors who dont have dev perms but have admin perms. I would make my own but I have never used TopBarPlus Extension. And also lot’s of people would probably like this.

1 Like

Whoops, I forgot: you also need to set yourself as an admin in the IsAdmin module script.

Screen Shot 2023-01-13 at 6.58.16 PM

Screen Shot 2023-01-13 at 6.59.17 PM

Oh weird. So it’s just doing nothing? Are you sure you have the correct user ID?

i did set myself as an admin in the module

1 Like

yep i did check i don’t know why it’s not working

1 Like