I am having a problem with Zed's Tycoon Kit Gamepasses, I have watched a video on how to make Developer Products for Zed's Tycoon kit, I followed the tutorial I do now know where I went wrong.
local Gamepasses = { -- This 'table' is where all of the gamepass ID's and rewards are stored.
[6151932] = {--Juggernaut
"H:200",
game.ServerStorage.M16
},
[6151862] = { -- normal vip
"H:80", -- Having "H:25" gives a boost of 25 extra health.
"W:15", -- Having "W:15" gives a boost of 15 extra speed.
10000
},
[6207381] = { -- Radio
game.ServerStorage.Radio
},
[6207466] = { -- 2x Cash
},
[6207563] = { -- Coil Pass
game.ServerStorage.AccelerationCoil,
game.ServerStorage.GravityCoil
},
[6207698] = { -- Extra Gear
game.ServerStorage.GrappleHook,
game.ServerStorage.GatlingLaserGun
}
}
local Items = { -- These are dev product items, basically one time use for weapons and character bonuses.
[503500545] = {
"H:65"
},
[503494116] = {
"W:15"
},
[513499490] = {
10000000
},
[503502994] = {
100000
},
[503510736] = {
1000000
},
[503480644] = {
game.ServerStorage.LaserRifle
}
}
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)