Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Gamepass Gear Script Broke just recently? Any ideas why?

Asked by 5 years ago
Edited 5 years ago

The Scripts worked perfectly up until about 2 week or so ago, Not a clue why , any help would be appreciated.




local GamePassId = 4444743 -- Gamepass IDs tools = {"Sword" , "Enfield Revolver"} -- Tool local MarketplaceService = game:GetService("MarketplaceService") function respawned(char) player = game.Players:FindFirstChild(char.Name) if char:FindFirstChild("Head") ~= nil then if MarketplaceService:UserOwnsGamePassAsync(player.UserId,GamePassId) then print('player owns pass') for i = 1,#tools do game.ServerStorage.Gamepasses:FindFirstChild(tools[i]):Clone().Parent = player.Backpack end end end end game.Workspace.ChildAdded:connect(respawned)

As per either something in game breaks the script, or Robloxs Studio Updates has broken the Script, My Gamepass Gear giver isnt working and I have no clue why....

1 answer

Log in to vote
0
Answered by 5 years ago

First, switch to GetService for every service. It is a guarantee to return the service specified. Workspace gets a pass since there is a "Workspace" property in the game object which is a reference to Workspace and is read-only.

Next, use RBXScriptSignal:Connect(), since RBXScriptSignal:connect() is deprecated. I also used the PlayerAdded event.

local storage = game:GetService"ReplicatedStorage"
local GamePassId = 4444743 -- Gamepass IDs
local tools = storage.Tools:GetChildren() -- Tool 
local MPS= game:GetService"MarketplaceService"

function onPlayerJoin(plr)
    if MPS:PlayerOwnsAsset(player, GamePassId) then
        print"player owns pass"
        for i = 1,#tools do
            local clone = tool[i]:Clone()
            clone.Parent = plr:WaitForChild"Backpack"
            local c2 = plr:WaitForChild("Backpack"):FindFirstChild(clone.Name)
            c2:Clone().Parent = plr:WaitForChild"StarterGear"
        end
    end
end

game:GetService("Players").PlayerAdded:Connect(onPlayerJoin)

0
Isn't it MPS:UserOwnsGamePassAsync(player, GamePassId)? Cause gamepasses now have their own id not asset id SirDerpyHerp 262 — 5y
0
Just trialed it and it didnt work Moo_Blinder 18 — 5y
Ad

Answer this question