lines 2 and 4 through 8 are ignored. The npc or layer does not take any damage.

function Damage(player, damage, bodypart, playerdamaged)
	workspace[playerdamaged].Humanoid:TakeDamage(damage)
	print("Hit " .. playerdamaged .. " in the " .. bodypart .. " and did " .. damage .. " damage.")
	if bodypart == "Helmet" then
		print("you knocked my helmet off")
		workspace[playerdamaged].Head.HelmetWeld:Destroy()
		workspace[playerdamaged].Helmet.Parent = workspace
	end
end

game.ReplicatedStorage.Damage.OnServerEvent:Connect(Damage)

5 comments

0

You are not passing any arguments for all the parameters that you have. Is the script throwing any errors?

0

Ok so it works online but not in studio, I know this doesnt affect real gameplay but it would be nice if will in studio i can see if its working.

0

No errors.

0

odd... I cant see what the issue is if it works online it should work is studio.

0

Where is the LocalScript?