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....
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)