Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local debounce = true
- local debounce2 = true
- local TouchPart = script.Parent
- local MarketplaceService = game:GetService("MarketplaceService")
- local Market
- local Gamepassid = 22076513
- function onTouched(hit)
- if hit.Parent:findFirstChild("Humanoid") and debounce then
- local player = Players:GetPlayerFromCharacter(hit.Parent)
- local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,22076513)
- if player and not ownsGamepass then
- debounce = false
- game:GetService("MarketplaceService"):PromptGamePassPurchase(player,22076513)
- wait(1)
- debounce = true
- end
- local Radio = player.Backpack:FindFirstChild("BoomBox")
- if ownsGamepass and not Radio then
- debounce = false
- local RadioBox = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("BoomBox"):Clone()
- local RadioBox2 = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("BoomBox"):Clone()
- RadioBox.Parent = player.Backpack
- RadioBox2.Parent = player.StarterGear
- wait(1.5)
- debounce = true
- return
- end
- if ownsGamepass and player.Backpack:FindFirstChild("BoomBox") then
- local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- debounce = false
- humanoid:UnequipTools()
- player.Backpack:FindFirstChild("BoomBox"):Destroy()
- player.StarterGear:FindFirstChild("BoomBox"):Destroy()
- wait(1.5)
- debounce = true
- return
- end
- end
- end
- local function gamepassPurchaseFinished(player,Gamepassid,wasPurchased)
- Market:Disconnect()
- if wasPurchased == true and debounce2 then
- debounce2 = false
- local RadioBox = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("BoomBox"):Clone()
- local RadioBox2 = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("BoomBox"):Clone()
- RadioBox.Parent = player.Backpack
- RadioBox2.Parent = player.StarterGear
- wait(1)
- debounce2 = true
- return
- else
- print("Canceled")
- return
- end
- end
- Market = MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)
- end
- TouchPart.Touched:connect(onTouched)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement