game.Players.PlayerAdded:connect(function(p) wait(1) for i, v in ipairs(game.Players:GetChildren())do v.Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=179631998" v.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=179650451" end end) -- Its a script in Workspace and it seems to work in solo mode, but doesn't in- game. Please help!
I've fiddled with the code a bit and made some improvements.
For whatever reason Start Server doesn't give the players a pants or shirt object so I added some code to fix that.
Version 1: This will give the player the shirt and pants when they join the game.
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.Character -- Wait for a character local char = p.Character if not char:FindFirstChild("Shirt") then -- If they don't have a shirt object give them one Instance.new("Shirt",char).Name = "Shirt" end if not char:FindFirstChild("Pants") then -- If they don't have a pants object give them one Instance.new("Pants",char).Name = "Pants" end char:WaitForChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=179631998" char:WaitForChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=179650451" end)
Version 2: This will give the player the shirt and pants every time they respawn and when they join the game
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(char) repeat wait() until p.Character -- Wait for a character local char = p.Character if not char:FindFirstChild("Shirt") then -- If they don't have a shirt object give them one Instance.new("Shirt",char).Name = "Shirt" end if not char:FindFirstChild("Pants") then -- If they don't have a pants object give them one Instance.new("Pants",char).Name = "Pants" end char:WaitForChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=179631998" char:WaitForChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=179650451" end) end)