so like its rewarding all clients and i dont want that how do i fix this???
01 | local rep = game.ReplicatedStorage |
02 | local remote = rep:WaitForChild( "ChangeValue" ) |
03 |
04 | debounce = true |
05 |
06 | while true do |
07 | wait( 1 ) |
08 | local plr = game:GetService( "Players" ).LocalPlayer |
09 | local Gui = plr.PlayerGui.Quest:WaitForChild( "DOIT" ) |
10 | local Gui 1 = plr.PlayerGui.Quest:WaitForChild( "Framo" ) |
11 | local Humanoid = game.Workspace.ThiefBoss:FindFirstChild( "Enemy" ) |
12 |
13 | Humanoid.Touched:Connect( function (hit) |
14 | local hum = hit.Parent:FindFirstChild( "Humanoid" ) |
15 | if Humanoid ~ = nil and debounce = = true then |
You will have to detect who touched the player last so that you know who killed him
This should be in a serverscript and will be something along the lines of
01 | local rep = game.ReplicatedStorage |
02 | local remote = rep:WaitForChild( "ChangeValue" ) |
03 | local plr = game:GetService( "Players" ).LocalPlayer |
04 | local Gui = plr.PlayerGui.Quest:WaitForChild( "DOIT" ) |
05 | local Gui 1 = plr.PlayerGui.Quest:WaitForChild( "Framo" ) |
06 | local Humanoid = game.Workspace.ThiefBoss:FindFirstChild( "Enemy" ) |
07 |
08 | local lastTouch |
09 | Humanoid.Touched:Connect( function (hit) |
10 | local p = game.Players:GetPlayerFromCharacter(hit.Parent) |
11 | if p then |
12 | lastTouch = p |
13 | end |
14 | end ) |
15 | Humanoid.Died:Connect( function () |
16 | local playerWhoKilled = lastTouch |
17 | --Do stuff here |
18 | end ) |