Changing an instance name not working

Hi, I’m currently trying to make a script that saves a uniform but I’m struggling to make this script I made work:

local Player = game.Players.LocalPlayer
local Char = Player.Character

local UniformPack = Player:FindFirstChild("UniformPack")

local MainShirt = Char:WaitForChild("Shirt")
local MainPants = Char:WaitForChild("Pants")

local InstanceShirt = Instance.new("Shirt")

local CharCloth = Char:WaitForChild("Clothing")

script.Parent.MouseButton1Click:Connect(function()
	UniformPack:ClearAllChildren()
	MainShirt:Clone()
	MainShirt.Parent = UniformPack

	InstanceShirt.Parent = Char
	CharCloth.Name = "Shirt"
end)

I have no idea why this is bugging. I tried finding posts related to this but they weren’t working either.

1 Like

A little information.

UniformPack is a folder in the player to store the clothes:

image

I believe you need to be changing the name from a server script. To do this, you need to fire a remote event, which is then received by a server script.

But how will I get the local player from the serverscript?

The first parameter received by the server is always the player instance, with the second (and third and so on) parameters being what you parsed along with the call

Alright. I’ll try to give it a try

Wait but how where do I find the char then?

local Character = Player.Character

image

What’s your server side code look like? It has to go in the event receiving code

It’s like this:

image

Local Script works fine on any part but this one I don’t know.

I need to know the code in each of them.

Nevermind I accidentally found it…

	InstanceShirt.Name = "Shirt"

When you do MainShirt:Clone(), save the clone to a variable and then set the parent of the variable instead.

I did that but it damages the Shirt and replaces it with the original one and not the decal shirt I’m using

But still. I appreciate you for trying to help and at least responding

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.