Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you change a Character's Head Mesh?

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

✓ Accepted answer

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.

2 comments

0

Thank you!

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.