Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
0
Answered by
Prioxis 673 Moderation Voter
8 years ago

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

Ad
Log in to vote
0
Answered by 8 years ago

Use an object value to record the player.

Answer this question