So I tried this and it wont work what do I do to fix it?
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local gamePassID = 0 function onPlayerSpawned(player) local hasPass = false local success, message = pcall(function() hasPass = MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID) end) if not success then warn("Error while checking if player has pass: " .. tostring(message)) return end if hasPass == true then local pant = Parent:GetChildren() for i=1,#pant do if (pant[i].className == "Pants") then pant[i].PantsTemplate = "http://www.roblox.com/asset/?id=0" end end local shirt = Parent:GetChildren() for i=1,#shirt do if (shirt[i].className == "Shirt") then shirt[i].ShirtTemplate = "http://www.roblox.com/asset/?id=0" end end end end game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function() onPlayerSpawned(player) end) end) Players.PlayerSpawned:Connect(onPlayerSpawned)
P.S you can use the fixed version its not just for me its for everyone!
The gamepass will not work if the user has no shirt or pants on (though people usually do). Instead of replacing the ID, you can wait for the clothes in the player, destroy them, and clone the gamepass clothes from (ServerStorage or Lighting or the Script) into the player. Basically, it destroys the player's old clothes and inputs the new clothes instead of changing the ID. Changing the ID does work as well, although if people have no clothes or some clothes, it won't work and you have to add more elements into your script to detect them.