How to make shirt/pants stay after death

Im doing shirt/pants giver and I want so when player dies/resets themselves they keep their shirt/pants on them

2 Likes

maybe just make a string value inside player name “TemporaryStuff” and just setattribute to it a string with the value of the stuff u stored somewhere in ur serverstorage and just getattribute those when characteradded event fired and give them back the shirt and pants

2 Likes

Connect to player.CharacterAdded to apply their shirts/pants when they respawn.

1 Like

Is it a part that you stand on to receive the clothes? Or are you giving them some other way?

1 Like

Button GUI is the way

dsfsdfdsffds

You can try what @RickAstll3y mentioned, using player.CharacterAdded so that every time the player respawns, the pants and shirt are on the player. CharacterAdded is for every player that respawns, rather than just one time, when the player joins the game with PlayerAdded.

Your code probably has PlayerAdded somewhere near the end of the script. Replace “PlayerAdded” with “CharacterAdded”, does this do anything?

edit: If you want to send your script, I will be happy to revise it for you. Cheers

1 Like

I have no code, but my idea is to create client script in button gui, make remote function in it and create server script that handles remote function

do you have any other ideas?

1 Like

I have a couple ideas, but you have to explain a bit more.

Do you want the button in the GUI to bring up a menu where you can select different looking pants and shirts for free, maybe buy them? Or do you want the button to apply shirt and pants to the player according to the team? Or should the button just apply random shirts and pants?

After you have that figured, and the new clothes are applied, we want to save them. You can either use Datastore for this or depending on the actual script you use to apply the new clothes, you might be able to use CharacterAdded so that the clothes apply every time a player joins the game.

1 Like

I want it so first you open up menu (which i already have) and then you select which shirt you want. They are free, choosing uniforms is manual, they arent random

1 Like

make a table with all the shirt/pants and always use ipairs when getting data from that table, when they select a shirt/pants, get the index of that from table and save that index somewhere u can access for them again when characteradded event fired

1 Like

what do you mean? dont understand ya

How do you give the player the clothings?

i suggest to start watching youtube basic roblox scripting tutorials first, hopping to devforum for help when you havent learn basics yet is not going to be efficient for ur journey, and i suggest hopping to studio first and try some things before going to devforum how to start

Not like I dont know scripting. I just didnt understand you and you tell me I cant script?

It’s shrimple tho. I just wanna know he gives the player shirts.

game:GetService("Players").PlayerAdded:Connect(function(Player)
	local ShirtValue = Instance.new("ObjectValue")
	ShirtValue.Name = "ShirtVAL"
	ShirtValue.Parent = Player
	local PantValue = Instance.new("ObjectValue")
	PantValue.Name = "PantVAL"
	PantValue.Parent = Player
	Player.CharacterAppearanceLoaded:Connect(function(Character)
		Player.ShirtVAL.Value = Character:WaitForChild("Shirt")
		Player.PantVAL.Value = Character:WaitForChild("Pants")
		Character:WaitForChild("Shirt").ShirtTemplate = Player.ShirtVAL.Value.ShirtTemplate
		Character:WaitForChild("Pants").PantsTemplate = Player.PantVAL.Value.PantsTemplate
	end)
end)

This is a snippet example.

im not trying to attack here, but using tables to store lots of data is very often used

You could have an IntValue inside the Player with the Shirt ID and Pants ID. Whenever the Player Character gets added. Let the Shirt ID equal to the Shirt Value of the player shirt and Pants ID.

You really shouldn’t need it here, it’s just 2 variables.

1 Like

he wanted to make a gui with all the shirt/pants for players to select, i suggest making a table for all those stuff and just store the index data of what the player decided to keep and when the player respawned, characteradded event fires and get the index number and check the table which one to clone and give to the player character

why table? just use objectvalues or stringvalues.