I’m trying to make a sound play when someone is donating with a developer product and I got the UI to work but not the sound.
I got some help with the remote event part of the script but we have no idea why it isn’t working
I was told to put the local script in StarterGui but I don’t know why.
Script in ServerScriptService
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ProductID = 1182433131--Donation Id1
local ProductID2 = 1182472598--Donation Id2
local ProductID3 = 1182472800--Donation Id3
local ProductID4 = 1182462265--Donation Id4
local ProductID5 = 1183533639
local ID6 = 1183534505
local remoteEvent = ReplicatedStorage:WaitForChild("DonatedRobux")
MarketplaceService.ProcessReceipt = function(ReceiptInfo)
if ReceiptInfo.ProductId == ProductID or ReceiptInfo.ProductId == ProductID2 or ReceiptInfo.ProductId == ProductID3 or ReceiptInfo.ProductId == ProductID4 or ReceiptInfo.ProductId == ProductID5 or ReceiptInfo.ProductId == ID6 then
local Player = game.Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
local PlayerGui = Player.PlayerGui.DonateUI
wait(1.3)
PlayerGui.SuccessMessage.Visible = true
remoteEvent:FireClient(ReceiptInfo.PlayerId)
print("Thank you for your donation!")
wait(15)
PlayerGui.SuccessMessage.Visible = false
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
Local Script in StarterGui
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("DonatedRobux")
remoteEvent.OnClientEvent:Connect(function()
script.CashSoundEffect:Play()
end)
I asked another developer and she said this.