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

Any way of detecting when a player kills a particular monster with a humanoid inside?

Say I have a mutant that has all humanoid etc inside and the player kills it how would I go about detecting this and making something happen.

Thanks in advance for any advice.

2 answers

✓ Accepted answer

Basically what I would do is, is whenever the player attacks the monster using the sword have the sword create a StringValue with the players name in it that way whenever the monster dies it knows to give credit to the player also including some sort of NumberValue that tracks how much damage so seeing if the player did so much damage vs other players would be a good way to give proper credit..

also having a value inside the monster with the monsters name would be a great help in distinguishing player vs mosnter

local character = script.Parent.Parent
script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("MonsterValue") then
	local val  = Instance.new("StringValue", hit.Parent)
	val.Value = game.Players:GetPlayerFromCharacter(character).Name
end)

hope this helps you understand it a bit better

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