Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I go about making the Frenzystart event stop after a X amount of seconds?

Asked by 6 years ago

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
0
If it's in a loop inside the FrenzyStart code try using break. YouSNICKER 131 — 6y
0
Also don't name your varaible "Spawn" because that's a function and could trigger you errors later on. YouSNICKER 131 — 6y

Answer this question