Script about a part appearing on my character isn't working

Okay so I want to make a script where if I press a certain key, it then spawns a part on my character. But it doesn’t seem to work, I asked on discord as well but none of it seems to work.

These are my scripts:

local re = game:GetService("ReplicatedStorage"):WaitForChild("HaoHakiEvent")

	if input.KeyCode == Enum.KeyCode.M then
		print ("M was pressed on localscript")

```Server Script: 

local function OnServerEvent(Player)
	local Character = Player.Character
	if (Character) then
		local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
		local HaoHaki = game:GetService("ReplicatedStorage"):WaitForChild("HaoHaki")
		if (HumanoidRootPart) then
			local HaoHakiClone = HaoHaki:Clone()
			HaoHakiClone.CFrame = HumanoidRootPart.CFrame
			HaoHakiClone.Parent = HumanoidRootPart

Only issue I can see is that from the server script you aren’t connecting the OnServerEvent function to the OnServerEvent signal of the remote, but I’d like to assume you are and just haven’t included that code. If you’re looking for help here then you need to explicitly include all relevant details as well as any errors that you’re getting in your console as none have been provided. As far as I’ve skimmed over this script there’s nothing actually wrong with it.

The Script isn’t running because , you just made the function but never connected it to the OnServerEvent of the RemoteEvent . You could do

local re = game:GetService("ReplicatedStorage"):WaitForChild("HaoHakiEvent")
re.OnServerEvent:Connect(OnServerEvent) -- OnServerEvent should be defined above

Also it would be better if you Welded the Haki to the Player’s Arm , so it doesn’t fall off from the Character.

1 Like

Right, thanks for replying. I’m gonna update it later, and see if it’s fixed. Also, the Haki I’m working on is Conqueror’s Haki. The round blue thing where everyone inside it gets knocked out.

Ah alright then , I don’t know much about different hakis. Good luck!