I've tried fixing the script, but it just doesn't work for me. Can someone please help me with the script. Here's the script:




local Gamepasses = {
	
	
	[732884508] = { 
		1000000
	},
	
	
	[732884250] = { 
		"H:30",	
		"W:10", 
	},
	
	
}

local Items = { 
	[54529181] = {
		1000
	},
	
	
	[54529200] = {
		game.ServerStorage.Minigun
	},
	
	
	[54529215] = {
		"W:25"
	},

	[54529220] = {
		"H:25"
	}
}




local MarketplaceService = game:GetService("MarketplaceService")

function GetName(ID)
	if type(ID) ~= "number" then
		return
	end
	local sets = game:service("InsertService"):GetUserSets(ID)
	for k, v in next, sets do
		if v.Name == "My Models" then
			return v.CreatorName
		end
	end
end

local function Sep(table,plr)
	for i,v in pairs(table) do
		if type(v)=="userdata" then
			v:Clone().Parent = plr.Backpack
		elseif type(v)=="number" then
			game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name).Value = game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name).Value + tonumber(v)
		else
			if v:sub(0,2) == "W:" then
				plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed + tonumber(v:sub(3))
			else
				plr.Character.Humanoid.MaxHealth = plr.Character.Humanoid.MaxHealth + tonumber(v:sub(3))
				plr.Character.Humanoid.Health = plr.Character.Humanoid.Health
			end
		end
	end
end

local function SepQ(table,plr)
	for i,v in pairs(table) do
		if type(v)=="userdata" then
			v:Clone().Parent = plr.Backpack
		elseif type(v)=="number" then
			return
		else
			if v:sub(0,2) == "W:" then
				plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed + tonumber(v:sub(3))
			else
				plr.Character.Humanoid.MaxHealth = plr.Character.Humanoid.MaxHealth + tonumber(v:sub(3))
				plr.Character.Humanoid.Health = plr.Character.Humanoid.Health
			end
		end
	end
end

MarketplaceService.ProcessReceipt = function(receiptInfo)
	print(receiptInfo.ProductId)
	if Items[receiptInfo.ProductId] then
		if type(GetName(receiptInfo.PlayerId)) == "string" then
			wait()
			local p5 = game.Players:FindFirstChild(GetName(receiptInfo.PlayerId))
			wait()
			Sep(Items[receiptInfo.ProductId],p5)
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted		
end

game.Players.PlayerAdded:connect(function(p)
	if p~=nil then
		for i,v in pairs(Gamepasses) do
			if MarketplaceService:PlayerOwnsAsset(p,i) then
				Sep(v,p)
			end
		end
		wait(0.5)
		p.CharacterAdded:connect(function(c)
			for i,v in pairs(Gamepasses) do
				if MarketplaceService:PlayerOwnsAsset(p,i) then
					SepQ(v,p)
				end
			end
		end)
	end
end)

Note: W is walkspeed and H is health.

3 comments

0

What exactly is the script accomplishing?

0

I don't understand what you're asking here?

0

the dev products are working but not the gamepasses becuase of the update that added playerownsgamepassasync but idk where to put it.