Okay, so I have an item in my game that will give you a random shout out(message) that will show up on every player's screen when you purchase it for a certain amount of robux. Sure it's cheesy or stupid, but I'm not here for your criticism I just want help. So it works but if the player buys it 2 times in a row it will get all glitchy. If another user buys it, it works fine but the problem is if the same user buys a shout out 2 times in a row the shout out will glitch and give 2 messages and 1 of the messages will say the default text (meaning it has not changed the message on the text). I'm a little bad at describing things so if you have any questions just ask. I don't think it's a problem with the variables because everything works I just think there's something wrong and I can't seem to find a solution.
The script (found in workspace):
local MarketplaceService = Game:GetService("MarketplaceService") local doublecoinsId = 21809336 local shoutoutId = 21812513 MarketplaceService.ProcessReceipt = function(receiptInfo) -- find the player based on the PlayerId in receiptInfo for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then -- check which product was purchased if receiptInfo.ProductId == doublecoinsId then -- handle purchase. In this case we are healing the player. player.PlayerGui.MainScreen.PlayerValues.HasCoinBooster.Value = true -- more feedback for the player. player.PlayerGui.MainScreen.Alert.Visible = true player.PlayerGui.MainScreen.Alert.Message.Text = "Purchase successful, the coinbooster will last until you die or until the next game ends!" elseif receiptInfo.ProductId == shoutoutId then for i, playeralert in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:FindFirstChild("Torso") then end local clone = game.Lighting.GoodCard:Clone() clone.Parent = playeralert.PlayerGui.MainScreen local randomsayingnum = math.random(1, 4) if randomsayingnum == 1 then clone.Message.Text = player.Name " is an MLG PRO, just sayin..." elseif randomsayingnum == 2 then clone.Message.Text = "Say in-chat HI " .. player.Name .. " over and over again until your fingers are bleeding!" elseif randomsayingnum == 3 then clone.Message.Text = "Go send " ..player.Name .. " a friend request because he da bozz!" elseif randomsayingnum == 4 then clone.Message.Text = "Shoutout to " ..player.Name .. " for being so awesome and skilled, you should be more like him!" end wait() end end end end return Enum.ProductPurchaseDecision.PurchaseGranted end