Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GetSpeaker with player.Name outputting (a nil value)?

This inputs - ServerScriptService.TagsConfigurer:6: attempt to index local 'Speaker' (a nil value)

local ChatService = require(script.Parent:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

game:GetService("Players").PlayerAdded:Connect(function(player)
	local Speaker = ChatService:GetSpeaker(player.Name)
	Speaker:SetExtraData("Tags", {{TagText = "["..player:GetRoleInGroup(5042036).."]", TagColor = player.TeamColor.Color}})
end)

1 answer

Try this:

local ChatService = require(script.Parent:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService('Players')

ChatService.SpeakerAdded:Connect(function(PlayerName)
    local Speaker = ChatService:GetSpeaker(PlayerName)
	local player = Players[PlayerName]
    Speaker:SetExtraData("Tags", {{TagText = "["..player:GetRoleInGroup(5042036).."]", TagColor = player.TeamColor.Color}})
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.