For some reason when this script is enabled, players cant see other players chat, any help?
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local function setprefixtext(value, message)
return "<font color='#"..(value:WaitForChild("Color").Value):ToHex().."'>["..value.Name.."]</font> " .. message.PrefixText
end
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
local props = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 839718134) then
props.PrefixText = setprefixtext(script:WaitForChild("V.I.D"), message)
end
if player.UserId == 869133154 then
props.PrefixText = setprefixtext(script:WaitForChild("OWNER"), message)
end
if player.UserId == 647598508 then
props.PrefixText = setprefixtext(script:WaitForChild("DEVELOPER"), message)
end
return props
end
end
The logic of your code, and how you’re altering the incoming message, is correct.
The issue probably lies in the way your instances are setup, going wrong at one of your WaitForChild.
Can you send a screenshot of the script and all it’s children in your Explorer?
When a message is not being sent, are you not getting any errors in your Output window (give it 10 seconds).
Error occurred while calling TextChatService.OnIncomingMessage: MarketPlace:UserOwnsGamePassAsync() can only query local player
This means you cannot use Marketplace:UserOwnsGamePassAsync() to check if other players own a game pass. To do so anyway you can use a RemoteFunction to have the server perform the check for the client.