Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how should i go about cloning shirt to a player?

Asked by 6 years ago

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)
0
You made a player variable, use it on line five. GoldenPhysics 474 — 6y
0
You made a variable on line 1, so use it. Stop wasting RAM. hiimgoodpack 2009 — 6y
0
already fixed it xD im so used to 64 gb of ram i dont even notice it skillfulzombie88 28 — 6y
0
You used clone incorrectly minikitkat 687 — 6y

1 answer

Log in to vote
0
Answered by
IcyEvil 260 Moderation Voter
6 years ago
Edited 6 years ago

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'

Ad

Answer this question