Advertisement
Guest User

LastHitter LocalScript (In StarterGui)

a guest
Jan 21st, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. -- reference: "Deathcam LocalScript" inside "PlayerGui / StarterGui"
  2.  
  3. function WaitForChild(where, what)
  4.     repeat
  5.         wait()
  6.     until where:FindFirstChild(what)
  7.     return where:FindFirstChild(what)
  8. end
  9.  
  10. local Players = game:GetService("Players")
  11. local Player = Players.LocalPlayer
  12. local Character = Player.Character -- character should exist
  13. local PlayerHumanoid = WaitForChild(Character,"Humanoid")
  14.  
  15. local ObjectValue = Instance.new("ObjectValue")
  16. ObjectValue.Parent = Character
  17. ObjectValue.Name = "LastHitter"
  18.  
  19. PlayerHumanoid.ChildAdded:connect(function(obj)
  20.     if (obj:IsA("ObjectValue")) then
  21.         ObjectValue.Value = obj.Value
  22.     end
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement