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

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

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

This is the script :

game.Workspace.ChildAdded:connect(function(player)
	local name = player.Name
	local playerinplayers = game.Players:FindFirstChild(player.Name)
	if playerinplayers ~= nil then
		playerinplayers.CanLoadCharacterAppearance = false
		player.Head.face.Texture = "rbxgameasset://Images/face1"
		player.Head.Transparency = 0
		local bodycolors = Instance.new("BodyColors", player) 
		bodycolors.TorsoColor = BrickColor.new("Pastel yellow")
		bodycolors.RightArmColor = BrickColor.new("Pastel yellow")
		bodycolors.LeftArmColor = BrickColor.new("Pastel yellow")
		bodycolors.HeadColor = BrickColor.new("Pastel yellow")
		bodycolors.LeftLegColor = BrickColor.new("Pastel yellow")
		bodycolors.RightLegColor = BrickColor.new("Pastel yellow")
		wait(2)
		local shirt = Instance.new("Shirt", player)
		shirt.ShirtTemplate = "rbxgameasset://Images/GokuShirt1"
		local pants = Instance.new("Pants", player)
		pants.PantsTemplate = "rbxgameasset://Images/GokuPants4"
		script.Disabled = true
	end
end)

2 comments

0

It should work. Although, I suggest using the PlayerAdded and CharacterAdded events.

0

I should warn you that there is a prohibition against allowing characters to be nude in games. This may be moderated.

1 answer

✓ Accepted answer

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:

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(character)
		-- your code here
		-- the player's character model is now in the "character" variable
	end
end

2 comments

0

Thanks, it worked! :)

0

Glad I could help!

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