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

how should i go about cloning shirt to a player?

Making a clothing store and I'm trying to clone the shirt to a player model when they touch the brick and I don't know to id go about finishing the rest of this script

local ClothesId = 298138999
local player = game.Players.LocalPlayer

function Touch()
	game.Players.LocalPlayer.Shirt.Clone()
end

script.Parent.Parent.Adornee.Touched:connect(Touch)

4 comments

0

You made a player variable, use it on line five.

0

You made a variable on line 1, so use it. Stop wasting RAM.

0

already fixed it xD im so used to 64 gb of ram i dont even notice it

0

You used clone incorrectly

1 answer

✓ Accepted answer

Don't use a LocalScript.

local ClothesId = 298138999

script.Parent.Touched:Connect(function(hit) 
	if hit.Parent then
local hum = hit.Parent:FindFirstChild("Humanoid")
	if hum then
local shirt = hit.Parent:FindFirstChild("Shirt")
	if shirt then
shirt.ShirtTemplate = ('http://www.roblox.com/asset/?id='..ClothesId)
			end
		end
	end
end)

*script.Parent.Touched:Connect(function(hit) * Does the same thing as function onTouched(hit)

It then goes to see if it has a humanoid, and if it has a shirt as well and changes the shirt to the clothing id.

All you need to change for any shirt is the 'ClothesId'

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