I've been working on an RPG map and I'm stuck... What my aim here is when a player joins, they spawn right above the brick (The onTouch one), and when they hit it the script happens so I can have a custom GUI with a character selection etc. What I'm after is how can I make this more efficient and so it happens without the player touching the brick?
function onTouch(hit)
if hit.Name == "Left Leg" then
for _,v in pairs(hit.Parent:GetChildren()) do
if v:IsA("CharacterMesh") then
v:Remove()
end
if v:IsA("Shirt") then
v:Remove()
end
if v:IsA("T-Shirt") then
v:Remove()
end
if v:IsA("Pants") then
v:Remove()
end
if v:IsA("Hat") then
v:Remove()
end
local headMesh = game.ServerStorage.HeadMesh
if headMesh ~= nil then
local head = hit.Parent.Head
local headMeshClone = headMesh:Clone()
headMeshClone.Parent = head
end
end
end
end
script.Parent.Touched:connect(onTouch)
Thanks, jakei181

1 comment
Thanks! May you show me how to do Player.CanLoadCharacterAppearance?