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

How could I make a script that adds a mesh into players when entering?

Asked by 10 years ago

I am trying to make a cool game, and I want to know how to add a block mesh into every body part of a player except for the head when they join/respawn. I also want to know how to add a head mesh into a player's head under these conditions. Any advice?

2 answers

Log in to vote
3
Answered by 10 years ago
game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Character)
        for i, part in pairs(Character:GetChildren()) do
            if part:IsA("Part") then
                if part.Name ~= "Head" then
                local Mesh = Instance.new("SpecialMesh", part)
                Mesh.Name = "Mesh"
                Mesh.MeshId = ""
                Mesh.TextureId = ""
                Mesh.MeshType = "Head" -- Whatever mesh type you want in it.
                else
                local Mesh = Instance.new("SpecialMesh", part)
                Mesh.Name = "Mesh"
                Mesh.MeshType = "Head"
                end
            end
        end
    end)
end)
Ad
Log in to vote
1
Answered by 10 years ago

You can use the Player Added event and inside of that function use the Character Added to add a mesh to a player everytime he/she spawns.

Answer this question