I’m trying to make global messages when a player rolls an 1/5,000,000 or higher and has been achieved, but for some reason the global one is displaying 1 in (player.Name)
. This is very weird and for the server one, it has no problem. Help is appreciated and below are scripts.
Server Messages Local Script: (index is the “1 in ???” and displayer is the same but with commas)
ocal c = game.ReplicatedStorage.ChatEvents.Chat
local FormatNumber = require(game.Workspace.FormatNumber.Main)
local formatter = FormatNumber.NumberFormatter.with()
local m = game:GetService("MessagingService")
c.GlobalMessages.OnClientEvent:Connect(function(Message)
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message.Data)
end)
c.Over1K.OnClientEvent:Connect(function(plr, index)
if index >= 1000 and index < 10000 then
local displayer = formatter:Format(index)
-- Gold hex code: #ffaa00
local Message = `<font color="#ffaa00">{plr.Name} has rolled an 1/{displayer}</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
elseif index >= 10000 and index < 100000 then
local displayer = formatter:Format(index)
-- Cyan hex code: #04AFEC
local Message = `<font color="#04AFEC">{plr.Name} has rolled an 1/{displayer}!</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
elseif index >= 100000 and index < 1000000 then
local displayer = formatter:Format(index)
-- Pink hex code: ##FF00BF
local Message = `<font color="##FF00BF">{plr.Name} has rolled an 1/{displayer}!</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
elseif index >= 1000000 and index < 5000000 then
local displayer = formatter:Format(index)
-- Red hex code: #FF0000
local Message = `<font color="#FF0000">{plr.Name} has rolled an 1/{displayer}! 🎉</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
elseif index >= 5000000 and index < 10000000 then -- 1/5M+
local displayer = formatter:Format(index)
local Message = `<font color="#FF0000">{plr.Name} has rolled an 1/{displayer}! 🎉</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
game.ReplicatedStorage.ChatEvents.Chat.Global1:FireServer(plr, displayer)
elseif index >= 10000000 and index < 100000000 then
local displayer = formatter:Format(index)
-- Purple hex code: #9D00FF
local Message = `<font color="#9D00FF">{plr.Name} has rolled an 1/{displayer}! ✨</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
game.ReplicatedStorage.ChatEvents.Chat.Global2:FireServer(plr, displayer)
elseif index >= 100000000 and index < 1000000000 then
local displayer = formatter:Format(index)
-- Light Lime hex code: #98FB98
local Message = `<font color="#98FB98">OMG! {plr.Name} has rolled an 1/{displayer}!✨✨✨</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
game.ReplicatedStorage.ChatEvents.Chat.Global3:FireServer(plr, displayer)
elseif index >= 1000000000 then
local displayer = formatter:Format(index)
-- Green hex code: #00FF00
local Message = `<font color="#00FF00">OMG! {plr.Name} has rolled an 1/{displayer}! 🔥🔥🔥</font>`
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
game.ReplicatedStorage.ChatEvents.Chat.Global4:FireServer(plr, displayer)
end
end)
Global Script 1(PublishingAsync)(and where it gets the 1 in plr.Name):
local m = game:GetService("MessagingService")
local r = game.ReplicatedStorage.ChatEvents.Chat
m:SubscribeAsync("GlobalChat", function(Message)
game.ReplicatedStorage.ChatEvents.Chat.GlobalMessages:FireAllClients(Message)
end)
r.Global1.OnServerEvent:Connect(function(plr, displayer)
local Message = `<font color="#FF0000">[GLOBAL]: {plr.Name} has rolled an 1/{displayer}! 🎉</font>`
m:PublishAsync("GlobalChat", Message)
end)
r.Global2.OnServerEvent:Connect(function(plr, displayer)
local Message = `<font color="#9D00FF">[GLOBAL]: {plr.Name} has rolled an 1/{displayer}! ✨</font>`
m:PublishAsync("GlobalChat", Message)
end)
r.Global3.OnServerEvent:Connect(function(plr, displayer)
local Message = `<font color="#98FB98">[GLOBAL]: OMG! {plr.Name} has rolled an 1/{displayer}!✨✨✨</font>`
m:PublishAsync("GlobalChat", Message)
end)
r.Global4.OnServerEvent:Connect(function(plr, displayer)
local Message = `<font color="#00FF00">[GLOBAL]: OMG! {plr.Name} has rolled an 1/{displayer}! 🔥🔥🔥</font>`
m:PublishAsync("GlobalChat", Message)
end)
Global Script 2(problem because of Global Script 1’s text problem):
The lines 6-8 on LocalScript(server only display)!
I do not receive any errors.
Again, help is appreciated!