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 MarketplaceService = game:GetService("MarketplaceService")
- local Market
- local Gamepassid = 22076502
- local part = script.Parent
- local function gamepassPurchaseFinished(player,Gamepassid,wasPurchased)
- Market:Disconnect()
- if wasPurchased == true then --and debounce2
- --debounce2 = false
- local AccelerationCoil = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("AccelerationCoil"):Clone()
- local AccelerationCoil2 = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("AccelerationCoil"):Clone()
- AccelerationCoil.Parent = player.Backpack
- AccelerationCoil2.Parent = player.StarterGear
- wait(1)
- else
- print("Canceled")
- --return
- end
- --debounce2 = true
- end
- function onTouched(hit)
- if hit.Parent:FindFirstChild("Humanoid") and debounce then
- debounce = false
- print("hit")
- local player = Players:GetPlayerFromCharacter(hit.Parent)
- local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,22076502)
- if player and not ownsGamepass and not debounce then
- print("lol1")
- local Prompt = game:GetService("MarketplaceService"):PromptGamePassPurchase(player,22076502)
- wait(1)
- end
- local Coil = player.Backpack:FindFirstChild("AccelerationCoil")
- if ownsGamepass and not Coil and not debounce then
- print("Cloning")
- local AccelerationCoil = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("AccelerationCoil"):Clone()
- local AccelerationCoil2 = game:GetService("ReplicatedStorage").GamepassItems:FindFirstChild("AccelerationCoil"):Clone()
- AccelerationCoil.Parent = player.Backpack
- AccelerationCoil2.Parent = player.StarterGear
- wait(1.5)
- debounce = true
- return
- end
- if ownsGamepass and player.Backpack:FindFirstChild("AccelerationCoil") and not debounce then
- local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- print("Destroying")
- humanoid:UnequipTools()
- player.Backpack:FindFirstChild("AccelerationCoil"):Destroy()
- player.StarterGear:FindFirstChild("AccelerationCoil"):Destroy()
- wait(1.5)
- debounce = true
- return
- end
- end
- end
- Market = MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)
- print("hi")
- debounce = true
- end
- part.Touched:connect(onTouched)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement