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

How do I insert a mesh into a block using a script?

Asked by
NecoBoss 194
10 years ago

Alright so basically I need to make a block turned into a hat. How would I use a script to complete that?

2 answers

Log in to vote
1
Answered by
Sublimus 992 Moderation Voter
10 years ago

Create a new mesh, and then parent it to the part:

Instance.new("SpecialMesh", game.Workspace.Part)
0
Alright Thanks alot man! :D NecoBoss 194 — 10y
0
No problem! Sublimus 992 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

If you wanted to make it simpler by using the :Clone() function you could do this:

Put a mesh in lighting, or somewhere else, then add a script wherever. Let's say when you hit a part, it will clone a mesh from lighting, and place it in your torso.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if hit.Parent:FindFirstChild("Torso") then
            cloneMesh = game.Lighting.Mesh:Clone()
            cloneMesh.Parent = hit.Parent.Torso
        end
    end
end)

There you go!

Answer this question