Why this uniform command doesn't work"

I’m doing a secret division for a group and we wanna do a command that changes our name and clothes, the part of the name is perfect, it works correctly, but the script doesn’t change the uniform :confused: I know that this is a terrible script, but I’m starting with lua :c

Please, help me do this script work :sob:

plr.Chatted:Connect(function(Message)
    if (Message:lower() == "!secret") then
     			 
				Clone1.statusholder.Visible = false
			   Clone1.color2.Disabled = false
				Clone1.group.rank.rank2.ranktext.Text = "LLH Secret Service"
				Clone1.group.name.name2.nametext.Text = "[CLASSIFIED]"
				Clone1.color.Disabled = true
				Clone1.group.name.name2.nametext.TextColor3 = Color3.fromRGB(255, 0, 0) 
				game.LocalPlayer.shirt.ShirtTemplate = ("https://www.roblox.com/library/973033762/SWR-I-Male-Top")
				game.LocalPlayer.pants.PantsTemplate = ("https://www.roblox.com/library/973032525/SWR-I-Male-Bottom")
				
    end
end)

I’m not 100% sure and don’t really code much but I’m pretty sure the links are supposed to just be the numbers and parenthesis.

“973033762”
“973032525”

1 Like

That is not how you define the LocalPlayer. Then again, you shouldn’t do chatted event on the client. You need to reference the player’s character.

The script is on server scriptservice, and it work for an afk command that ff the player and it changes the name tag.

Your only problem is that you didn’t get the player’s character. You can do this by:

local character = plr.Character or plr.CharacterAdded:Wait()

You can only change the pant and shirt inside the player’s character.

Hmmm, I don’t understand it, I did this:

plr.Chatted:Connect(function(Message)
    if (Message:lower() == "!secret") and plr.Name == "Carlos_Hernandez30" --[[Dom]] or plr.Name == "Dacaco_2006" or plr.Name == "Charles_RichardDavod" --[[gala]] or plr.Name == "Imacooldude_10" --[[dac]]then
     		local character = plr.Character or plr.CharacterAdded:Wait()	 
				Clone1.statusholder.Visible = false
			   Clone1.color2.Disabled = false
				Clone1.group.rank.rank2.ranktext.Text = "LLH Secret Service"
				Clone1.group.name.name2.nametext.Text = "[CLASSIFIED]"
				Clone1.color.Disabled = true
				Clone1.group.name.name2.nametext.TextColor3 = Color3.fromRGB(255, 0, 0) 
				character.LocalPlayer.shirt.ShirtTemplate = ("rbxassetid://973033762")
				character.LocalPlayer.pants.PantsTemplate = ("rbxassetid://973032525")
				
    end
end)

Because LocalPlayer can only be used in a local script, you need to do:

character.Pants.PantsTemplate = --id
character.Shirt.ShirtTemplate = --id
2 Likes

I give you an tips, already instead of using the names for whitelist use the Id and uses a list instead of making 200 different lines

Id becose if player change name the id don’t change
and a list because it’s easier and faster to use on the end

what ??? why are you talking about robux

He means instead of checking the player’s name when they chatted, check their user ID by doing plr.UserId. This is because your name can be changed but you UserId doesn’t.

1 Like

To change a name you need robux, and also if we change name or account is very simple to edit…

And make a table with all ID for verify if is admin

yes, but in logic it’s better to put the id and it changes nothing

I don’t think he needs to go through all this process, what he only needs is for the command to change the shirt and pants. This is what his topic is for.

1 Like

When you define character.Shirt.ShirtTemplate, it checks if there is a child named “Shirt” in the character. If there is, is the ShirtTemplate a property or child? Since it is a property, it will change it with the specified asset ID after the equal sign:

character.Shirt.ShirtTemplate = "rbxassetid://973033762"

You also need to remember that only LocalPlayer works in local script.

1 Like