Absolutely! If you'd like to change the system so that both players become "tagged" when they touch (like a mutual tag or zombie tag style), I can update the script accordingly.
Below is the updated version of the script with the following behavior:
✅ New Behavior:
When the current It player touches another player, both players become "IT".
This spreads the "infection" — now two players are "It" and can tag others.
All players who are "It" get the red IT! indicator.
Players who are not tagged remain green as runners.
🔁 How It Works:
We'll use a folder in Workspace called InfectedPlayers to track who's been tagged.
Each player has an attribute: IsInfected.
The GUI updates based on this attribute.
When a tagged player tags someone, they both infect the untagged player.
📦 Setup Instructions
1. Create the Overhead GUI in ReplicatedStorage
(Exactly as before)
Insert a BillboardGui named TagIndicator
Add a TextLabel inside it called StatusLabel
Same settings as before for position, size, color, etc.
2. Replace your TagManager Script with the Following Code:
lua
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- CONFIGURATION
local RUNNER_COLOR = Color3.fromRGB(85, 255, 127) -- Green
local IT_COLOR = Color3.fromRGB(255, 85, 85) -- Red
-- VARIABLES
local TagIndicatorTemplate = ReplicatedStorage:WaitForChild("TagIndicator")
-- Folder to keep track of infected (IT) players
local InfectedPlayers = Instance.new("Folder")
InfectedPlayers.Name = "InfectedPlayers"
InfectedPlayers.Parent = workspace
-- =================================================
-- HELPER FUNCTIONS
-- =================================================
-- Function to update the overhead GUI based on player state
local function updatePlayerIndicator(player)
local character = player.Character
if not character then return end
local head = character:FindFirstChild("Head")
local tagGui = head and head:FindFirstChild("TagIndicator")
if tagGui then
local statusLabel = tagGui.StatusLabel
local isInfected = player:GetAttribute("IsInfected")
if isInfected then
statusLabel.Text = "IT!"
statusLabel.TextColor3 = IT_COLOR
else
statusLabel.Text = "Runner"
statusLabel.TextColor3 = RUNNER_COLOR
end
end
end
-- Function to tag a player
local function tagPlayer(tagger, target)
if not target or not target:IsDescendantOf(Players) then return end
if target:GetAttribute("IsInfected") then return end -- Already infected
print(tagger.Name .. " tagged " .. target.Name)
-- Mark as infected
target:SetAttribute("IsInfected", true)
updatePlayerIndicator(target)
-- Add to InfectedPlayers folder
if not InfectedPlayers:FindFirstChild(target.UserId) then
local tagHandle = Instance.new("IntValue")
tagHandle.Name = tostring(target.UserId)
tagHandle.Value = target.UserId
tagHandle.Parent = InfectedPlayers
end
end
-- =================================================
-- TAGGING LOGIC
-- =================================================
local function onCharacterTouched(otherPart, toucherCharacter)
local toucherPlayer = Players:GetPlayerFromCharacter(toucherCharacter)
if not toucherPlayer then return end
local targetCharacter = otherPart.Parent
local targetPlayer = Players:GetPlayerFromCharacter(targetCharacter)
if not targetPlayer or targetPlayer == toucherPlayer then return end
local targetHumanoid = targetCharacter:FindFirstChildOfClass("Humanoid)
if not targetHumanoid or targetHumanoid.Health <= 0 then return end
-- Only allow tagging if at least one player is infected
if toucherPlayer:GetAttribute("IsInfected") then
tagPlayer(toucherPlayer, targetPlayer)
elseif targetPlayer:GetAttribute("IsInfected") then
tagPlayer(targetPlayer, toucherPlayer)
end
end
-- =================================================
-- PLAYER MANAGEMENT
-- =================================================
local function onCharacterAdded(character, player)
local humanoid = character:WaitForChild("Humanoid")
-- Setup the overhead indicator
local head = character:WaitForChild("Head")
local newIndicator = TagIndicatorTemplate:Clone()
newIndicator.Parent = head
-- Update the indicator immediately
updatePlayerIndicator(player)
-- Connect touch events
local root = character.PrimaryPart or character:FindFirstChild("HumanoidRootPart") or character:FindFirstChild("Torso")
if root then
root.Touched:Connect(function(otherPart)
onCharacterTouched(otherPart, character)
end)
end
-- Handle death
humanoid.Died:Connect(function()
-- Remove from infected list if they die
local userIdValue = InfectedPlayers:FindFirstChild(tostring(player.UserId))
if userIdValue then
userIdValue:Destroy()
end
end)
end
local function onPlayerAdded(player)
-- Initialize player attributes
player:SetAttribute("IsInfected", false)
player:GetAttributeChangedSignal("IsInfected"):Connect(function()
updatePlayerIndicator(player)
end)
player.CharacterAdded:Connect(function(character)
onCharacterAdded(character, player)
end)
if player.Character then
onCharacterAdded(player.Character, player)
end
-- First player becomes "IT"
if #InfectedPlayers:GetChildren() == 0 then
tagPlayer(player, player)
end
end
-- =================================================
-- INITIALIZATION
-- =================================================
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(function(player)
local userIdValue = InfectedPlayers:FindFirstChild(tostring(player.UserId))
if userIdValue then
userIdValue:Destroy()
end
end)
for _, player in ipairs(Players:GetPlayers()) do
task.spawn(onPlayerAdded, player)
end
-- Wait a moment and assign first "IT" if none exists
task.wait(3)
if #InfectedPlayers:GetChildren() == 0 and #Players:GetPlayers() > 0 then
tagPlayer(Players:GetPlayers()[1], Players:GetPlayers()[1])
end
🧠 Game Logic Summary
Situation
Result
Untagged player touches tagged player
Both become tagged
Tagged player touches untagged player
Untagged becomes tagged
Tagged vs tagged
Nothing happens
First player joins
Automatically becomes tagged
Would you like me to add any of these features next?