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

Help w/ when a Character joins game, they have a certain clothing?

Asked by
FiredDusk 1466 Moderation Voter
9 years ago

I don't know what to do.. when someone would join my game, I would like for them to have a certain kind on clothes. (All Characters) Thank you if you could help :)

2 answers

Log in to vote
1
Answered by
AmiracIe 175
9 years ago

So you want the player to have a certain shirt and pants when they join the game.

To accomplish this, we're going to take the original shirts and pants off the player when they join the game. Our code so far would look like this:

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        player.CanLoadCharacterAppearance=false 
    end)
end)    

Next we want to put on the clothes that we want the player to have. Let's make an instance of a shirt and put that as a variable named 'shirt'. Let's also make an instance of pants and put that as a variable named 'pants'.

local shirt = Instance.new("Shirt")
local pants = Instance.new("Pants")

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        player.CanLoadCharacterAppearance=false
    end)
end)    

Take the ID of the shirt and pant you want, found at the end of the URL, and subtract one from it. So if you want this shirt, the shirt template would be http://www.roblox.com/asset/?id=51350913. Let's store these in a variable. The shirt and pant ID used are simply examples. You'll have to change them to whatever you want.

local shirt = Instance.new("Shirt")
local shirtID="http://www.roblox.com/asset/?id=51350913"
local pantID = "http://www.roblox.com/asset/?id=137169695"

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        player.CanLoadCharacterAppearance=false
    end)
end)    

Now we're going to want to put the asset IDs on the templates for the shirt and pants. We're then going to put the shirt and pants on the player's character.

local shirt = Instance.new("Shirt")
local shirtID="http://www.roblox.com/asset/?id=51350913"
local pantsID = "http://www.roblox.com/asset/?id=137169695"

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        player.CanLoadCharacterAppearance=false

        shirt.ShirtTemplate=shirtID
        shirt.Parent=player.Character

        pants.PantsTemplate=pantsID
        pants.Parent=player.Character
    end)
end)    

There you have it! Sorry if some stuff is confusing. I'm kind of a nooby scripter but I tried my best to help you. Don't forget to vote and select an answer! :)

By the way, "player.CanLoadCharacterAppearance=false" will change the color of the player to the basic "noob" colors. If you need help changing them back or something, just ask and I will try my best to help you.

Ad
Log in to vote
-1
Answered by
Soulzs 0
9 years ago

Well this might help. You know morphs right? Well put a morph in the spawn and hide the body they spawn into away from the map.

Anyway that might help :)

Sincealy Soulzs

Answer this question