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

How would I insert a SpecialMesh in a HumanoidRootPart?

Asked by 5 years ago

I've been trying to make this script work but no luck so far.

player = game.Player.LocalPlayer
local character = player.Character
MeshInsert = Instance.new("SpecialMesh", character.HumanoidRootPart)
0
Don't use the 2nd argument of Instance.new() It's deprecated. mixgingengerina10 223 — 5y

1 answer

Log in to vote
0
Answered by
jaschutte 324 Moderation Voter
5 years ago
Edited 5 years ago

The second argument of Instance.new() is deprecated, which means you shouldn't use it anymore, and HumanoidRootPart has a transparency of 1, meaning you can't see it. Even with a mesh, I would suggest using Torso (R6) instaid of HumanoidRootPart. If your game is R15, just change the UpperTorso and LowerTorso mesh as they already are MeshParts.

-----------------------------------------------------------------------R6
player = game.Player.LocalPlayer
local character = player.Character
MeshInsert = Instance.new("SpecialMesh")
MeshInsert.Parent = character.Torso
MeshInsert.MeshId = "" --your mesh id
MeshInsert.TextureId = "" --your mesh texture id
-----------------------------------------------------------------------R15
player = game.Player.LocalPlayer
local character = player.Character
local Torso = character.UpperTorso
Torso.MeshId = "" --your (first) mesh id
Torso.TextureID = "" --your (first) mesh texture id
local Torso = character.LowerTorso
Torso.MeshId = "" --your (second) mesh id
Torso.TextureID = "" --your (second) mesh texture id

And if you NEED to use HumanoidRootPart, here you go:

player = game.Player.LocalPlayer
local character = player.Character
MeshInsert = Instance.new("SpecialMesh")
MeshInsert.Parent = character.HumanoidRootPart
MeshInsert.MeshId = "" --your mesh id
MeshInsert.TextureId = "" --your mesh texture id
character.HumanoidRootPart.Transparency = 0
--make sure the Torso (R6) or UpperTorso & LowerTorso (R15) are invisible by making thier transparency 1, otherwise it would look kinda wierd.

I hope this helped you!

FE SERVER SCRIPT EDITION:

game.Players.PlayerAdded:Connect(function(plr)
    repeat wait() until game.Workspace:FindFirstChild(plr) 
    local character = game.Workspace:FindFirstChild(plr) 
--from here the rest of the code is the same
    MeshInsert = Instance.new("SpecialMesh")
    MeshInsert.Parent = character.HumanoidRootPart
    MeshInsert.MeshId = "" --your mesh id
    MeshInsert.TextureId = "" --your mesh texture id
    character.HumanoidRootPart.Transparency = 0
    --make sure the Torso (R6) or UpperTorso & LowerTorso (R15) are invisible by making thier transparency 1, otherwise it would look kinda wierd.
end) --don't forget this end!
0
It works, but how would I make it work with FilteringEnabled? Aurified 12 — 5y
0
game.Players.ChildAdded:Connect(function(plr) repeat wait() until game.Workspace:FindFirstChild(plr.Name) local character = game.Workspace:FindFirstChild(plr.Name) jaschutte 324 — 5y
0
end) jaschutte 324 — 5y
0
Replace the first couple of lines of code with the new one, I'll edit the answer. jaschutte 324 — 5y
View all comments (3 more)
0
Alright, thanks! Aurified 12 — 5y
0
I tried using it but it would not work. I tried several different solutions such as adding local in front of MeshInsert. I also tried to see what was going on in the output tab but there was nothing. Aurified 12 — 5y
0
Never mind, I have fixed it. Thank you for your effort! I really appreciate it. Aurified 12 — 5y
Ad

Answer this question