Just a local script:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	
	
	player.Character.Head.h:Destroy()
	
		wait()
	
	local h1 = game.ReplicatedStorage.Hairs.h1:Clone()
	h1.Name = "h"
	h1.Parent = player.Character.Head
	
	local weld = Instance.new("Weld")
	weld.Parent = h1
	weld.Part0 = player.Character.Head
	weld.Part1 = h1
	weld.C0 = CFrame.new(0,0,0)
	weld.C1 = CFrame.new(0,-0.5,0)

	
	
end)

When using events:

Local Script:

script.Parent.MouseButton1Click:Connect(function()
	
	
	workspace.Events.h1:FireServer()
	
	
end)

Server Script:

wait()
script.Parent.OnServerEvent:Connect(function(player)
	
	player.Character.Head.h:Destroy()
	
		wait()
	
	local h1 = game.ReplicatedStorage.Hairs.h1:Clone()
	h1.Name = "h"
	h1.Parent = player.Character.Head
	
	local weld = Instance.new("Weld")
	weld.Parent = h1
	weld.Part0 = player.Character.Head
	weld.Part1 = h1
	weld.C0 = CFrame.new(0,0,0)
	weld.C1 = CFrame.new(0,-0.5,0)

	
	
end)

Both of these ways work only in studio.

5 comments

0

Can you revert back to the events? This only works in studio because you're either using LocalPlayer in a server script or trying to clone something and replicate it to all clients in a local script.

0

on it

0

Done, the question itself has changed go ahead and take a look, hope u find a solution.

0

What parts of the script work? Does the player's head get destroyed when using just the local script?

0

h means hair, and everything works perfectly in the studio, but nothing works in the game