Healing Item Not Working

Alright, so I have made something like a Golden Apple from Minecraft, it works but for some reason its not working at the same time. I have tried so many things but none of them patch it. Here is a YouTube video showing whats happening:

function MyFunctions.ConsumeItem(this)
	wait(workspace)
	local Tool = this.Parent.Parent
	local Player = game.Players.LocalPlayer
	local plrName = Player.Name
	local plrWorkspace = game.Workspace:FindFirstChild(plrName)
	Tool.Equipped:Connect(function(mouse)
		mouse.Button2Down:Connect(function()
			plrWorkspace:FindFirstChild("Humanoid").Health = plrWorkspace:FindFirstChild("Humanoid").MaxHealth
		end)	
	end)	
end

Could we have a picture of the console? (F9 in test mode or /console in the chat), along with the output.

There is nothing in the console, I checked.

Nothing important. Or related to this topic.

Could you like elaborate it a lil bit? Cuz rn i dont understand the problem.

Watch the video, When I right click it makes my health back to normal but then for some reason it doesnt.

Okay wait. So your waiting for the workspace?? That should not happen at all, the workspace is already created when someone is on the loading screen.

Idk why I put that, but I just removed it and it still works

I honestly have no ideas of what the issue is.

Is it a local script or a normal script?

Actually, that is a pretty good question.

Mayb the other Decrease health function is running after this script

There isn’t any decrease health functions though?

Anyways, let’s not go off-topic. @Sayfside , is it a local or serverside script?

He didnt send it in devforum here. There prob is one script lik tht

You cannot use " local player " for normal server scripts. It only works for local scripts.

Normal, I tried a local script and it still didn’t work.

Not normal script, I meant module script

Also I have to go rn, but Ill be back in a few hours

Did you stop decreasing the plrs health after the gainhealth script runs?