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

How do you change a Character's Head Mesh?

Asked by 2 years ago
Edited 2 years ago

I made a script that activates whenever a player joins, I want them to have a block-like character morph.

The code:

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        --change mesh
        character.Head:WaitForChild("Mesh").MeshType = Enum.MeshType.Head
        print(character.Head.Mesh.MeshType)
    end)
end)

The problem is whenever I hit play, the head mesh doesn't change. Also there are no errors presented at this time.

1 answer

Log in to vote
0
Answered by
KingDomas 153
2 years ago
Edited 2 years ago

Fairly certain this won't work as it's on the server's side, so you'd need to do this via a remotefunction?

Script:

rs = game:GetService("ReplicatedStorage")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character.Head:WaitForChild("Mesh").MeshType = Enum.MeshType.Head
        print(character.Head.Mesh.MeshType)
        rs:WaitForChild("RemoteFunction"):InvokeServer()
    end)
end)

Script in ServerScriptStorage:

remoteFunction = Instance.new("RemoteFunction")
remoteFunction.Parent = game:GetService("ReplicatedStorage")

remoteFunction.OnServerInvoke:Connect(function()
--delete head mesh
end)

At least this is what I think, otherwise not too sure. Hope you find the fix.

0
Thank you! ercleric 24 — 2y
0
No problem. KingDomas 153 — 2y
Ad

Answer this question