****Hello,
All what I wanna do is when the NPC died the player that killed that NPC get rewarded,
Because with my current script when the NPC dies everyone gets rewarded any help plz?
local Stats = game.Players.LocalPlayer.leaderstats local Gold = Stats.Gold wait(1) local hum = game.Workspace.Dummy.Dummy:FindFirstChild("Humanoid") player = game.Players.LocalPlayer hum.Died:Connect(function() print("Die") print(player.Name.."Killed it") print("her is your reward"..player.Name) Gold.Value = Gold.Value + 50 if player:FindFirstChild("BruterTag") then local BruterTag = player:FindFirstChild("BruterTag") if BruterTag.Value >= 1 then BruterTag.Value = BruterTag.Value -1 else if BruterTag == 0 then BruterTag:Destroy() local ir = Instance.new("BoolValue", player) ir.Name = "FinishedBruterTag" print("BruterTag") print("Script Finished Working") end end end end)
I had this question a while ago. To find a specific player, you need to make a temporary tag on that player. The code below is a good way to tag the player.
local tag = human.Died:Connect(function() --this will run if you inflicted the final hit end) wait(0.1) tag:Disconnect()
Ok so i have not answered many questions on this account, so here it goes, its a honer :) So to do this i believe you, ok so first how do you kill NPC? gun or sword or punch? When answer this then ill give you answer how to do this.