Greetings. The title says it all.
You basically want to check if a player owns the badge using BadgeService then award the Tag if it returns true (to do this you can search “how to give player chat tags”, I cannot provide an example since im at the shops but this is a way to go)
Heres a script that can help you:
local Players = game:GetService("Players")
local badgeId = --Your Badge
local badgeSerivce = game:GetService("BadgeService")
Players.PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
if player then
if badgeSerivce:UserHasBadgeAsync(player.UserId, badgeId) then
--instance a new value to player and call it chattag
end
end
end)
Then we need to get the chats:
local chatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local tags = {
[0] = {TagText = "NAMETHISSOMETHING", TagColor = Color3.fromRGB(255, 0, 0)}, -- The 0 must be changed to the the id of the user you want the tag to have
}
chatService.SpeakerAdded:Connect(function(playerName)
local speaker = chatService:GetSpeaker(playerName)
local player = game.Players[playerName]
if player:FindFirstChild("Chattag") then
speaker:SetExtraData("Tags",{tags[0]})
end
end)
Thank you for your help. Have a nice day.
No problem! You enjoy your day too.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.