Hello, I’m PLX, I was updating my Roblox game but I ran into a problem, the donation messages that go on the chat are not working in-game, but only in the studio, so can someone explain what’s wrong?
Here are my scripts:
Server
game.MarketplaceService.ProcessReceipt = function(PI)
local buyer = PI.PlayerId
local Username = game.Players:GetPlayerByUserId(buyer)
local PlrFormat = Username.Name.." ("..Username.DisplayName..")"
if PI.ProductId == 1779402676 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"5")
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif PI.ProductId == 1523381164 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"10")
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif PI.ProductId == 1523381162 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"25")
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif PI.ProductId == 1523381160 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"50")
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif PI.ProductId == 1523381158 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"100")
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif PI.ProductId == 1523381161 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"500")
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif PI.ProductId == 1523381159 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"1000")
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif PI.ProductId == 1523381157 then
game.ReplicatedStorage.DonationServerMessage:FireAllClients(PlrFormat,"1000")
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
Client
game.ReplicatedStorage.DonationServerMessage.OnClientEvent:Connect(function(plr,arg)
if not arg then return end
if arg == "5" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>has donated \u{E002} 5 robux!</font>")
elseif arg == "10" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>has donated \u{E002} 10 robux!</font>")
elseif arg == "25" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>has donated \u{E002} 25 robux!!</font>")
elseif arg == "50" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>has donated \u{E002} 50 robux! wow!</font>")
elseif arg == "100" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>has donated \u{E002} 100 robux!! Nice!</font>")
elseif arg == "500" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>has donated \u{E002} 500 robux!! WOW!</font>")
elseif arg == "1000" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>has donated \u{E002} 1,000 robux!! WOWWW!</font>")
elseif arg == "10000" then
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("[SERVER]: "..plr.." <font color='rgb(0,255,0)'>HAS DONATED \u{E002} 10,000 ROBUX!?!?! YOOOO!!</font>")
end
end)