Main Script

script.FrenzyStart.OnServerEvent:connect(function(player)
script.Parent.Parent.SpawnTime.Value = 5


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Coin = ReplicatedStorage:WaitForChild('Coin')
local DropperPart = script.Parent
local Spawn = script.Parent.Parent.SpawnTime.Value
script.Parent.Transparency = 1
while wait(Spawn) do
local NewCoin = Coin:Clone()
NewCoin.Parent = DropperPart
NewCoin.CFrame = DropperPart.CFrame
game:GetService('Debris'):AddItem(NewCoin,Spawn)


end
end)

Gui Script

local marketplaceService = game:GetService("MarketplaceService")

marketplaceService.ProcessReceipt = function(purchaseInfo)
	local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId)
	if purchaseInfo.ProductId == 122550429 then
game.Workspace.CoinSpawns.CoinDropper.Main.FrenzyStart:FireServer()
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
	end

2 comments

0

If it's in a loop inside the FrenzyStart code try using break.

0

Also don't name your varaible "Spawn" because that's a function and could trigger you errors later on.