I'm making a tycoon and I have a game pass where if you own it, you get a special upgrader. There's a physical button for this game pass in the tycoon and it works perfectly for me where if I step on the button, the upgrader appears (note that I'm the owner of the game). But, when my friend who isn't the owner tests it out (and I made sure he owned the game pass), every time he stepped on the button, it would always say that he already owned the game pass and his account wasn't charged, and the upgrader never appears when he stepped on the button. So why does it only work for me as an owner of the game and not for others who own the game pass?

Here is the script:

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 -- Don't be confused by this line, it's referring to the owner of the tycoon, not the actual game itself, and I also made sure my friend was the owner of the tycoon
							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'):PromptGamePassPurchase(player,v.Gamepass.Value)
											end

4 comments

0

Do any errors appear in the output?

0

print the owner to see if its nil for others. Also does it only work in the studio?

0

Nope, I don't see any errors in the output

0

And it works in both studio and out of studio