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

How do i make a player's clothes appear when they died/respawned?

Asked by
oSyM8V3N 429 Moderation Voter
7 years ago

I have a script where it morphs the players shirt, and pants, but when they die, it disappear.

This is the script :

01game.Workspace.ChildAdded:connect(function(player)
02    local name = player.Name
03    local playerinplayers = game.Players:FindFirstChild(player.Name)
04    if playerinplayers ~= nil then
05        playerinplayers.CanLoadCharacterAppearance = false
06        player.Head.face.Texture = "rbxgameasset://Images/face1"
07        player.Head.Transparency = 0
08        local bodycolors = Instance.new("BodyColors", player)
09        bodycolors.TorsoColor = BrickColor.new("Pastel yellow")
10        bodycolors.RightArmColor = BrickColor.new("Pastel yellow")
11        bodycolors.LeftArmColor = BrickColor.new("Pastel yellow")
12        bodycolors.HeadColor = BrickColor.new("Pastel yellow")
13        bodycolors.LeftLegColor = BrickColor.new("Pastel yellow")
14        bodycolors.RightLegColor = BrickColor.new("Pastel yellow")
15        wait(2)
View all 22 lines...
0
It should work. Although, I suggest using the `PlayerAdded` and `CharacterAdded` events. Goulstem 8144 — 7y
0
I should warn you that there is a prohibition against allowing characters to be nude in games. This may be moderated. XAXA 1569 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

Instead of using workspace.ChildAdded, use Player.CharacterAdded. http://wiki.roblox.com/index.php?title=API:Class/Player/CharacterAdded

You'll want to attach this event to each player upon joining:

1game.Players.PlayerAdded:connect(function(plr)
2    plr.CharacterAdded:connect(function(character)
3        -- your code here
4        -- the player's character model is now in the "character" variable
5    end
6end
0
Thanks, it worked! :) oSyM8V3N 429 — 7y
0
Glad I could help! BreadyToCrumble 121 — 7y
Ad

Answer this question