I tried creating this game-pass script that would prompt me whenever i press on it.

I think the problem has something to do when i touch it

local MarketPlaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local PromptSpeed = game.Workspace:WaitForChild("PromptSpeed")
local PromptBox = game.Workspace:WaitForChild("PromptPart")
local PromptPower = game.Workspace:WaitForChild("PromptJump")
local PromptVip = game.Workspace:WaitForChild("PromptVIP")

local function OnPromptPurchase(player, gamepassId)
	
	local HasPass = false
	
	local Humanoid = player.Parent:FindFirstChildOfClass("Humanoid")
	
	if (Humanoid) then
		player = game.Players:GetPlayerFromCharacter(player.Parent)
		
	HasPass = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, gamepassId)	
	end
	
	if HasPass then print("Player has the gamepass already") return end
	
	if not HasPass then
		PromptSpeed.Touched:Connect(function(player)
			MarketPlaceService:PromptGamePassPurchase(player, 8638546)
			end)
				
				if not HasPass then
					PromptBox.Touched:Connect(function(player)
						MarketPlaceService:PromptGamePassPurchase(player, 8582273)
				end)
					if not HasPass then
						PromptPower.Touched:Connect(function(player)
							MarketPlaceService:PromptGamePassPurchase(player, 8796152)
					end)
						if not HasPass then
							PromptVip.Touched:Connect(function(player)
								MarketPlaceService:PromptGamePassPurchase(player, 8757181)
						end)
					end
					end
					end
					end
					end

Please help

8 comments

0

My god

0

Nobody is going to help if you demand for your question to be answered.

0

I'm sorry man. I was a douche that day. It was a problem. It's something personal i don't want to talk about : -)

0

@Feahren - I know that i suck at scripting. You don't need to bring me down and make me stop scripting.

0

It should work like that, maybe it's in the PromptVIP, etc..

0

Yeah, i think so. Maybe it's something to do with if not haspass. because i wrote it 4 times.

0

Is someone still gonna help me :( ?

0

reupload you're question but don't make the title feel so demanding. Make you're title like this: How to make a button that prompts gamepass purchase?. and then add you're script in the desc. I already did that method and somebody actually helped me