local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local RP = game:GetService("ReplicatedStorage")
local CriminalTags = RP.CriminalTags
local PoliceTags = RP.PoliceTags
local Criminal = Teams.Criminal
local Police = Teams.Police
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local head = char:WaitForChild("Head")
local CriminalLevelText = CriminalTags.CriminalLevelText
local CriminalNameText = CriminalTags.CriminalNameText
local PoliceLevelText = PoliceTags.PoliceLevelText
local PoliceNameText = PoliceTags.PolicerNameText
task.defer(function()
CriminalTags.Adornee = head
CriminalTags.Parent = head
PoliceTags.Adornee = head
PoliceTags.Parent = head
end)
if player.Team == Criminal then
CriminalTags.Enabled = true
PoliceTags.Enabled = false
CriminalLevelText.Text = "Lv: "..player.leaderstats.CriminalLevel.Value
CriminalLevelText.TextColor3 = Color3.fromRGB(255, 183, 0)
CriminalNameText.TextColor3 = Color3.fromRGB(255, 64, 0)
end
if player.Team == Police then
CriminalTags.Enabled = false
PoliceTags.Enabled = true
PoliceLevelText.Text = "Lv: "..player.leaderstats.PoliceLevel.Value
PoliceLevelText.TextColor3 = Color3.fromRGB(0, 234, 255)
PoliceNameText.TextColor3 = Color3.fromRGB(0, 110, 255)
end
CriminalNameText.Text = player.Name
PoliceNameText.Text = player.Name
end)
end)
The if loops doesn’t work perfectly, when I change the team from criminal to police, the name tag and level still the same color and same value as the criminal level. Why it doesn’t change to police color tag and police level value when I change to police team ?
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local RP = game:GetService("ReplicatedStorage")
local CriminalTags = RP.CriminalTags
local PoliceTags = RP.PoliceTags
local Criminal = Teams.Criminal
local Police = Teams.Police
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local head = char:WaitForChild("Head")
local CriminalLevelText = CriminalTags.CriminalLevelText
local CriminalNameText = CriminalTags.CriminalNameText
local PoliceLevelText = PoliceTags.PoliceLevelText
local PoliceNameText = PoliceTags.PolicerNameText
task.defer(function()
CriminalTags.Adornee = head
CriminalTags.Parent = head
PoliceTags.Adornee = head
PoliceTags.Parent = head
end)
if player.Team == Criminal then
CriminalTags.Enabled = true
PoliceTags.Enabled = false
CriminalLevelText.Text = "Lv: "..player.leaderstats.CriminalLevel.Value
CriminalLevelText.TextColor3 = Color3.fromRGB(255, 183, 0)
CriminalNameText.TextColor3 = Color3.fromRGB(255, 64, 0)
end
if player.Team == Police then
CriminalTags.Enabled = false
PoliceTags.Enabled = true
PoliceLevelText.Text = "Lv: "..player.leaderstats.PoliceLevel.Value
PoliceLevelText.TextColor3 = Color3.fromRGB(0, 234, 255)
PoliceNameText.TextColor3 = Color3.fromRGB(0, 110, 255)
end
player:GetPropertyChangedSignal("Team"):Connect(function()
--do the changes here to the tags
end
CriminalNameText.Text = player.Name
PoliceNameText.Text = player.Name
end)
end)
It’s not the tags I want to change, I just want when the player changes his team to Criminal for example the CriminalTags will be enabled and PoliceTags will be false enabled, and if he changes his team to Police the PoliceTags will be enabled and CriminalTags will be false enabled
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local RP = game:GetService("ReplicatedStorage")
local CriminalTags = RP.CriminalTags
local PoliceTags = RP.PoliceTags
local Criminal = Teams.Criminal
local Police = Teams.Police
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local head = char:WaitForChild("Head")
local CriminalLevelText = CriminalTags.CriminalLevelText
local CriminalNameText = CriminalTags.CriminalNameText
local PoliceLevelText = PoliceTags.PoliceLevelText
local PoliceNameText = PoliceTags.PolicerNameText
task.defer(function()
CriminalTags.Adornee = head
CriminalTags.Parent = head
PoliceTags.Adornee = head
PoliceTags.Parent = head
end)
player:GetPropertyChangedSignal("Team"):Connect(function()
--do the changes here to the tags
if player.Team == Criminal then
CriminalTags.Enabled = true
PoliceTags.Enabled = false
CriminalLevelText.Text = "Lv: "..player.leaderstats.CriminalLevel.Value
CriminalLevelText.TextColor3 = Color3.fromRGB(255, 183, 0)
CriminalNameText.TextColor3 = Color3.fromRGB(255, 64, 0)
end
if player.Team == Police then
CriminalTags.Enabled = false
PoliceTags.Enabled = true
PoliceLevelText.Text = "Lv: "..player.leaderstats.PoliceLevel.Value
PoliceLevelText.TextColor3 = Color3.fromRGB(0, 234, 255)
PoliceNameText.TextColor3 = Color3.fromRGB(0, 110, 255)
end
end)
CriminalNameText.Text = player.Name
PoliceNameText.Text = player.Name
end)
end)