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

How to get a Spesefic Player?

Asked by 6 years ago

****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?

01local Stats = game.Players.LocalPlayer.leaderstats
02local Gold = Stats.Gold
03 
04wait(1)
05local hum = game.Workspace.Dummy.Dummy:FindFirstChild("Humanoid")
06player = game.Players.LocalPlayer
07hum.Died:Connect(function()
08 
09 
10 
11    print("Die")
12 
13print(player.Name.."Killed it")
14 
15print("her is your reward"..player.Name)
View all 33 lines...

2 answers

Log in to vote
0
Answered by 6 years ago

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.

1local tag = human.Died:Connect(function()
2--this will run if you inflicted the final hit
3end)
4wait(0.1)
5tag:Disconnect()
0
This doesnt work gamix912 0 — 6y
0
what is wrong with it? EliteRayGawnX2 124 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

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.

0
what? this would be better formatted as a comment theking48989987 2147 — 6y
0
well, whatever CommanderCaubunsia 126 — 6y
0
Punsh or Sword gamix912 0 — 6y

Answer this question