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

Renaming a shirt/pants, can someone help?

I have a script that change clothing, sometimes the script dont find a shirt, so the script create a new shirt on the player, and it comes with name "Clothing", and the script cant to find the shirt because the name is different, can someone help me? My script :

local ChangerPart = script.Parent
local ShirtTemplate = "http://www.roblox.com/asset/?id=1234"
local PantsTemplate = "http://www.roblox.com/asset/?id=1234

ChangerPart.Touched:Connect(function(TouchPart)
	if TouchPart and TouchPart.Parent and TouchPart.Parent:FindFirstChild("Humanoid") then
		print(TouchPart.Parent.Name ..  " - Changed clothes")
		local Character = TouchPart.Parent
		local shirt = Character:FindFirstChildOfClass("Shirt")
		local pants = Character:FindFirstChildOfClass("Pants")
		if not shirt then 
			shirt = Instance.new("Shirt", Character)
		end 
		if not pants then 
			pants = Instance.new("Pants", Character)
		end
		Character.Shirt.ShirtTemplate = ShirtTemplate
		Character.Pants.PantsTemplate = PantsTemplate
		wait(3)
	end
end)

(I got this script from a youtube tutorial, and i made some changes, and a guy helped me to make the system to create a new shirt if dont find one)

1 answer

✓ Accepted answer

lol hi again.

if not shirt then 
	shirt = Instance.new("Shirt", Character)
	shirt.Name = "Shirt"
end 
if not pants then 
	pants = Instance.new("Pants", Character)
	pants.Name = "Pants"
end

1 comment

0

Wow, thank you soooo much!!!!!!

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