Zeds tycoon kit gamepass button not working

  1. What do you want to achieve? a working gamepass button

  2. What is the issue? it doesnt work, no errors or anything

  3. What solutions have you tried so far? i looked for ‘fixed’ versions, tried modifying the code, nothing works

this is the code the tycoon uses for it

			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"):UserOwnsGamePassAsync(player.userId, v.Gamepass.Value) then
												Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
											else
												game:GetService("MarketplaceService"):PromptGamePassPurchase(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

With the Gamepass Button Example that comes with the kit, inside of the model you should see “Gamepass” which is an IntValue. Change the Value property to the GamepassId.

2 Likes

There are actually a few things you’ll need to do to make sure your pass button works using this kit.

  1. As @Tylerisawsome113 said you need to change the “Gamepass” value under the button model to the desired GamePass ID.
  2. You need to place the “Gamepass Button” model into the “Buttons” model
  3. There needs to be a model inside the “Purchases” model that is named whatever the “Object” value under the button is. (This means there has to actually be something your purchasing before it will work)
  4. You need to decide if you want there to be dependancy on the gamepass. (Meaning does the player need to unlock something else before they can buy the pass). If not, delete the “Dependency” value under the button.

See the image below for an example. The “test gamepass” model (pink) is an edited copy of the “Gamepass Button Exmaple”. The test object for purchase is the “test1” model (red). The Object value under the button (red) has the value “test1” (the object’s name)

Hope this helps!

1 Like

It works! Thank you very much for the help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.