Help and Feedback Scripting Support
In some games in roblox like Super Hero Life II, Robloxian Highschool, the players’ roleplay names appear in the chat instead of their actual names like this: I was wondering how i could do that in my game and make it so players’ roleplay names actually appear on the chat like that. Thanks! 2 Likes
Rename Chat Speaker Scripting Support Hello Developers! Currently, I’m trying to rename a player speaker so if is in a team his name in the classic chat can be changed to Classified or to another player name. I have a look into the forums and the chat service, but nothing really worked. So here my problem is there any way to rename a player speaker? If so is there a function in the chat service? 2 Likes
After looking for a while that did help but did not solve the problem
You need to set the extra data now, it’s kinda like making chat tags: local ReplicatedStorage = game:GetService('ReplicatedStorage') local changeNickname = ReplicatedStorage:WaitForChild('changeNickname') local ChatService = require(script.Parent:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService')) changeNickname.OnServerEvent:Connect(function(player, nickname) local Speaker = ChatService:GetSpeaker(player.Name) Speaker:SetExtraData('DisplayName', nickname) end)1 Like
Just a second, i’ll test it out
Ok, i made a textbox and a button for the name. This is the script i used script.Parent.MouseButton1Click:Connect(function() local nickname = script.Parent.Parent.TextBox.Text game.ReplicatedStorage.Events.changeNickname:FireServer(nickname) end)And then for the server script i used yours local ReplicatedStorage = game:GetService('ReplicatedStorage') local changeNickname = ReplicatedStorage.Events:WaitForChild('changeNickname') local ChatService = require(script.Parent:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService')) changeNickname.OnServerEvent:Connect(function(player, nickname) local Speaker = ChatService:GetSpeaker(player.Name) Speaker:SetExtraData('DisplayName', nickname) end)And yet it didn’t work Did i do something wrong?
Did you do everything that the forum post said? It should work if you’ve done that.
I did do the modifications in the chat script
No, but i’m pretty sure the error is in the server script, i inserted prints in both scripts and the server script didn’t print script.Parent.MouseButton1Click:Connect(function() local nickname = script.Parent.Parent.TextBox.Text game.ReplicatedStorage.Events.changeNickname:FireServer(nickname) print("text is " .. nickname) end) local changeNickname = game.ReplicatedStorage.Events.changeNickname local ChatService = require(script.Parent:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService')) changeNickname.OnServerEvent:Connect(function(player, nickname) print("received, text is " .. nickname) local Speaker = ChatService:GetSpeaker(player.Name) Speaker:SetExtraData('DisplayName', nickname) print("done") end)
Is the server script in ServerScriptService?
It’s in a folder inside it. So yes I’m 90% sure the error is in one of these two lines local ChatService = require(script.Parent:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService')) changeNickname.OnServerEvent:Connect(function(player, nickname)
Well if it’s in a folder then it wouldn’t be local ChatService = require(**script.Parent**:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService')) It should be script.Parent.Parent in that case. 1 Like
Yep, that solved it. Everything is working. Thanks a lot! And sorry for not realizing that lol 1 Like
Help and Feedback Scripting Support
How do I make a Roleplay Name GUI that you can customise the colours (I already have a basic RP name with just grey text) 1 Like
If you need to color text of Gui instances set the TextColor3 property. TextLabel.TextColor3 = Color3.new(1, 0, 0) --red text
I said i already have the RP name but i don’t know how to make it with colors
I added how to achieve that right at the bottom of my reply.
like this
I might be able to do it myself but i don’t know where the billboard GUI will be located once it is Instanced do you know what the exact place the text label will be located?
Dieseires:
Put it on the character’s head.
Can you show your basic rp name script?
Whats the code to get to the players head
remoteEvent.OnServerEvent:Connect(function(plr, name) local char = plr.Character or plr.CharacterAdded:Wait() local filteredName = game:GetService("TextService"):FilterStringAsync(name, plr.UserId) local filteredNameAsString = filteredName:GetNonChatStringForBroadcastAsync() local nameGui = char.Head:FindFirstChild("NameGui") local nameLabel = nameGui:FindFirstChild("NameLabel") nameLabel.Text = filteredNameAsString end)
Just parent the BillboardGui to the character’s head.
remoteEvent.OnServerEvent:Connect(function(plr, name) local char = plr.Character or plr.CharacterAdded:Wait() local filteredName = game:GetService("TextService"):FilterStringAsync(name, plr.UserId) local filteredNameAsString = filteredName:GetNonChatStringForBroadcastAsync() local nameGui = char.Head:FindFirstChild("NameGui") local nameLabel = nameGui:FindFirstChild("NameLabel") nameLabel.TextColor3 = Color3.new(0,0,0) --Change to the color you want nameLabel.Text = filteredNameAsString end)
better way to put the billboardgui to the player head is using .Adornee so you dont have to move around the gui, use .Adornee instead of .Parent |