Alright guys I need some help as you may know I am a youtuber that teaches people to make roblox games. My most popular series is “How To Make A Game Like Super Power Training Simulator”. In the game you gain and lose reputation when you kill players, I already have that but what I need help with is making the tag (in the chat) that says their Status change when their Status stat changes.
Any help will be very appreciated!
Current Code:
local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')
local ChatService = require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
ChatService.SpeakerAdded:Connect(function(PlayerName)
local tagText = Players[PlayerName]:WaitForChild("leaderstats"):WaitForChild("Status")
local color = nil
if tagText.Value == "Innocent" then
color = Color3.fromRGB(255,255,255)
elseif tagText.Value == "Outlaw" then
color = Color3.fromRGB(189, 83, 83)
elseif tagText.Value == "Supervillan" then
color = Color3.fromRGB(194, 0, 0)
elseif tagText.Value == "Savior" then
color = Color3.fromRGB(0, 191, 255)
elseif tagText.Value == "Superhero" then
color = Color3.fromRGB(0, 100, 255)
end
local Speaker = ChatService:GetSpeaker(PlayerName)
Speaker:SetExtraData('NameColor', color)
Speaker:SetExtraData('Tags', {{TagText = tagText.Value, TagColor = color}})
end)