My gamepass becomes mistaken for a t-shirt which is offsale, and thus I do not receive the rewards the gamepass has to offer, namely, health, and walkspeed, does anybody know how to fix the script? I have attempted changing the PlayerOwnsAsset to UserOwnsGamePassAsync, still does not work. Here is the script, it was not made by me, however it is a very good script for the tools and immediate after purchase. I do not need the products, only the gamepassess.
--Zed's Market Handler
local Gamepasses = { -- This 'table' is where all of the gamepass ID's and rewards are stored.
[732884508] = {
1000000
},
[5180158] = { -- normal vip
"H:30", -- Having "H:25" gives a boost of 25 extra health.
"W:10", -- Having "W:15" gives a boost of 15 extra speed.
},
}
local Items = { -- These are dev product items, basically one time use for weapons and character bonuses.
[54529181] = {
1000
},
[54529200] = {
game.ServerStorage.Minigun
},
[54529215] = {
"W:25"
},
[54529220] = {
"H:25"
}
}
--[[
If you don't want any devproducts then just simply remove everying inside of "Items" empty such as:
local Items = {
}
And the same thing for gamepasses, if you don't have any gamepasses in your game then simply remove everything under the Gamepass table:
local Gamepasses = {
}
Questions? Message Zed_YT or watch my YouTube tutorials on how this works!
THANKS!
P.S. Ignore the below code
]]
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)
