Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont this auto shirt and pant script work?

wait(3)
 game.Players.PlayerAdded:connect(function(plr)
    local a = plr:FindFirstChild("Shirt")
	local b	= plr:FindFirstChild("Pants")
	wait(2)    
    if a and b then
        a:Destroy()
 	    b:Destroy()
    end
    Instance.new("Shirt",plr).ShirtTemplate = "70029859"
    Instance.new("Pants",plr).PantsTemplate = "66502974"
end)

1 comment

0

Edited.

1 answer

✓ Accepted answer

In the PlayerAdded event you have a player argument, If you are locating the Player's Uniforms check the Character instead by using the CharacterAdded event.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local a = character:WaitForChild("Shirt")
        local b = character:WaitForChild("Pants")
		wait(1)
       	a.ShirtTemplate = "rbxasset://70029859"
		b.PantsTemplate = "rbxasset://66502974"
    end)
end)

Edited

Other than Removing the Original Clothing why not change the Clothes ID instead.

2 comments

0

Ok but when I play Solo I still have no uniform.

3

The script starts too late in Play Solo to fire PlayerAdded. You can fix that by not using an anonymous function, and calling it each player currently playing at the bottom of the script.

This discussion is preserved as it was. New answers, comments, and votes are closed.