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

Why wont this auto shirt and pant script work?

Asked by
Nidoxs 190
8 years ago
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)
0
Edited. rexbit 707 — 8y

1 answer

Log in to vote
2
Answered by
rexbit 707 Moderation Voter
8 years ago

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.

0
Ok but when I play Solo I still have no uniform. Nidoxs 190 — 8y
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. BlueTaslem 18071 — 8y
Ad

Answer this question