Hey so i want to make a script where if the player buys the devprod, a part falls from the sky randomly on the map which is a 200x200 (with Y = 20).
local mps = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local devProductId = 1228235407
local function promptPurchase ()
local player = players.LocalPlayer
mps:PromptProductPurchase(player, devProductId)
end
script.Parent.MouseButton1Click:Connect(promptPurchase)
mps.PromptProductPurchaseFinished:Connect(function(userId, productId, isPurchased)
if isPurchased then
local Player = players:GetPlayerByUserId(userId)
if Player then
if productId == devProductId then
local part = Instance.new("Part")
local randomX = math.random()
local randomY = math.random()
local randomZ = math.random()
part.Size = Vector3.new(4,1,2)
part.Position = Vector3.new(randomX, randomY, randomZ)
part.Parent = workspace
end
elseif not Player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
end)