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

Item changes mesh of head so head disappears instead of wearing it?

I'm trying to make a catalog as when you click a button, you wear a hat. Thanks!

local player = game.Players.LocalPlayer
local button = script.Parent

button.MouseButton1Down:Connect(function()
	local pp = game.ReplicatedStorage.DesertScout.Mesh:Clone()
	pp.Parent = player.Character.Head

end)

2 answers

What you are doing is adding a new mesh to the player's head. The new mesh replaces the old mesh. To fix this, you will have to add an Accessory to the player's model.

3 comments

0

Would i then have to add Attachments to the accessory then

0

I don't believe so.

0

So ive made the script spawn the hat but its not attached

So i have this which spawns the hat inside the player but its not connected.


local button = script.Parent
	
	button.MouseButton1Down:Connect(function()
		local hit = game.Players.LocalPlayer.Character
			hit.Parent:findFirstChild("Humanoid")
		
		local h = Instance.new("Accessory")
		local p = Instance.new("Part")
		local a = Instance.new("Weld")
		h.Name = "Tophat"
		h.Parent = hit
		p.Parent = h
		a.Parent = p
		p.Position = hit:WaitForChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(2, 1, 1) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
		game.Workspace.Hat.Mesh:Clone().Parent = p
		
		h.AttachmentPos = Vector3.new(-1, 0.3, 0)
		

	end)

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