Do i need to make a script for this?

I’m using Zernov’s tycoon kit and the gamepass buttons don’t work. Do I need to add a script?

4 Likes

no just make your own gamepass ids and paste them on the ids where the gamepasses are located

2 Likes

It doesn’t work for some reason

1 Like

Are you testing out the gamepasses in studio? Is workspace.AllowThirdPartySales enabled?

2 Likes

what does the script look like? does it prompt the gamepass or no?

2 Likes

Isn’t TPS for items that are not sold by the game?

2 Likes

Usually, it is. To OP: Are you sure your items are owned by you?

2 Likes

They are owned by me and a game im making. it wont event promt the gamepass sale

1 Like

Can you show us the script atleast?

2 Likes

I can try its a huge script though

1 Like
script.Parent:WaitForChild("Buttons")
	for i,v in pairs(script.Parent.Buttons:GetChildren()) do
		spawn(function()
		if v:FindFirstChild("Head") then
			
			local ThingMade = script.Parent.Purchases:WaitForChild(v.Object.Value)
			if ThingMade ~= nil then
				Objects[ThingMade.Name] = ThingMade:Clone()
				ThingMade:Destroy()
			else
				--//Button doesn't have object, remove it
				error('Object missing for button: '..v.Name..', button has been removed')
				v.Head.CanCollide = false
				v.Head.Transparency = 1
			end
									
			if v:FindFirstChild("Dependency") then --// if button needs something unlocked before it pops up
				v.Head.CanCollide = false
				v.Head.Transparency = 1
				coroutine.resume(coroutine.create(function()
					if script.Parent.PurchasedObjects:WaitForChild(v.Dependency.Value) then
						if Settings['ButtonsFadeIn'] then
							for i=1,20 do
								wait(Settings['FadeInTime']/20)
								v.Head.Transparency = v.Head.Transparency - 0.05
							end
						end
						v.Head.CanCollide = true
						v.Head.Transparency = 0
					end
				end))
			end
			
			v.Head.Touched:connect(function(hit)
				local player = game.Players:GetPlayerFromCharacter(hit.Parent)
				if v.Head.CanCollide == true then
					if player ~= nil then
						if script.Parent.Owner.Value == player then
							if hit.Parent:FindFirstChild("Humanoid") then
								if hit.Parent.Humanoid.Health > 0 then
									local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
									if PlayerStats ~= nil then
										if (v:FindFirstChild('Gamepass')) and (v.Gamepass.Value >= 1) then
											if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,v.Gamepass.Value) then
												Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
											else
												game:GetService('MarketplaceService'):PromptPurchase(player,v.Gamepass.Value)
											end
										elseif (v:FindFirstChild('DevProduct')) and (v.DevProduct.Value >= 1) then
											game:GetService('MarketplaceService'):PromptProductPurchase(player,v.DevProduct.Value)
										elseif PlayerStats.Value >= v.Price.Value then
											Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
											Sound(v, Settings.Sounds.Purchase)
										else
											Sound(v, Settings.Sounds.ErrorBuy)
										end
									end
								end
							end
						end
					end
				end
			end)
			end
		end)
	end
1 Like

Thats the part that handle the buttons/ gamepass button to

1 Like

From what i can see there’s a number value inside the buttons that has the gamepass id, did u change that?

2 Likes

I’m gonna change the code if you actually did put the id’s in:



script.Parent:WaitForChild("Buttons")
	for i,v in pairs(script.Parent.Buttons:GetChildren()) do
		spawn(function()
		if v:FindFirstChild("Head") then
			
			local ThingMade = script.Parent.Purchases:WaitForChild(v.Object.Value)
			if ThingMade ~= nil then
				Objects[ThingMade.Name] = ThingMade:Clone()
				ThingMade:Destroy()
			else
				--//Button doesn't have object, remove it
				error('Object missing for button: '..v.Name..', button has been removed')
				v.Head.CanCollide = false
				v.Head.Transparency = 1
			end
									
			if v:FindFirstChild("Dependency") then --// if button needs something unlocked before it pops up
				v.Head.CanCollide = false
				v.Head.Transparency = 1
				coroutine.resume(coroutine.create(function()
					if script.Parent.PurchasedObjects:WaitForChild(v.Dependency.Value) then
						if Settings['ButtonsFadeIn'] then
							for i=1,20 do
								wait(Settings['FadeInTime']/20)
								v.Head.Transparency = v.Head.Transparency - 0.05
							end
						end
						v.Head.CanCollide = true
						v.Head.Transparency = 0
					end
				end))
			end
			
			v.Head.Touched:connect(function(hit)
				
				if v.Head.CanCollide == true then
					if player ~= nil then
						if script.Parent.Owner.Value == player then
							if hit.Parent:FindFirstChild("Humanoid") then
								if hit.Parent.Humanoid.Health > 0 then
									local player = game.Players:GetPlayerFromCharacter(hit.Parent)
									local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
									if PlayerStats ~= nil then
										if (v:FindFirstChild('Gamepass')) and (v.Gamepass.Value >= 1) then
											if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,v.Gamepass.Value) then
												Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
											else
												game:GetService('MarketplaceService'):PromptPurchase(player,v.Gamepass.Value)
											end
										elseif (v:FindFirstChild('DevProduct')) and (v.DevProduct.Value >= 1) then
											game:GetService('MarketplaceService'):PromptProductPurchase(player,v.DevProduct.Value)
										elseif PlayerStats.Value >= v.Price.Value then
											Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
											Sound(v, Settings.Sounds.Purchase)
										else
											Sound(v, Settings.Sounds.ErrorBuy)
										end
									end
								end
							end
						end
					end
				end
			end)
			end
		end)
	end
2 Likes

what exactly did you change? It also still doesn’t seem to work.

1 Like

did you change that?
tbh i dont see nothing wrong with the code
also is third party sales enabled?

2 Likes

I did change that number. Also why would 3rd party sales need to be enabled in my own game?

1 Like

do u own the gamepasses btw? cuz the script checks if u do

2 Likes

yep I own it

need 30 need 30 need 30

1 Like

well so that’s whyyyy lol

hola

2 Likes