Advertisement
Upscalefanatic3

(Roblox) KillVoiceSound Script [Unknown]

Apr 3rd, 2020
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Gui--
  2. local menu = gui.Reference("MISC", "GENERAL", "Extra")
  3. local killsound = gui.Checkbox(menu, "killsound", "Kill Sound", 0)
  4. local killsound_time = gui.Slider(menu, "killsound_time", "Killsound Time", 0.6, 0, 10, 0.1 )
  5. local currentTime = 0
  6. local timer = 0
  7. local enabled = true
  8. local fl_val, flp_val = nil, nil
  9. killsound:SetDescription("Plays sound when you kill someone")
  10. killsound_time:SetDescription("*Should be equal to your file's length")
  11. gui.Text(menu, "File name and settings should be:")
  12. gui.Text(menu, "voice_input")
  13. gui.Text(menu, "Wave Microsoft (.wav)")
  14. gui.Text(menu, "22050hz  MONO 32 or 16 bit")
  15.  
  16. --Function--
  17. local function handler()
  18.     local snd_time = killsound_time:GetValue()
  19. currentTime = globals.RealTime()
  20. if currentTime >= timer then
  21. timer = globals.RealTime() + snd_time
  22. if enabled then
  23. client.SetConVar("voice_loopback", 0, true)
  24. client.SetConVar("voice_inputfromfile", 0, true)
  25. client.Command("-voicerecord", true)
  26. enabled = false
  27. gui.SetValue("misc.fakelag.enable", fl_val)
  28. gui.SetValue("misc.fakelag.peek", flp_val)
  29. end
  30. end
  31. end
  32. local function on_player_death(Event)
  33.     local snd_time = killsound_time:GetValue()
  34. if killsound:GetValue() == false or Event:GetName() ~= "player_death" then
  35. return
  36. end
  37. local INT_ATTACKER = Event:GetInt("attacker")
  38. if INT_ATTACKER == nil then
  39. return
  40. end
  41. local local_ent = client.GetLocalPlayerIndex()
  42. local attacker_ent = entities.GetByUserID(INT_ATTACKER)
  43. if local_ent == nil or attacker_ent == nil then
  44. return
  45. end
  46. if (attacker_ent:GetIndex() == local_ent) then
  47. fl_val, flp_val = gui.GetValue("misc.fakelag.enable"), gui.GetValue("misc.fakelag.peek")
  48. gui.SetValue("misc.fakelag.enable", 0)
  49. gui.SetValue("misc.fakelag.peek", 0)
  50. client.SetConVar("voice_loopback", 1, true)
  51. client.SetConVar("voice_inputfromfile", 1, true)
  52. client.Command("+voicerecord", true)
  53. timer, enabled = globals.RealTime() + snd_time, true
  54. end
  55. end
  56. --Callbacks--
  57. client.AllowListener("player_death")
  58. callbacks.Register("FireGameEvent", on_player_death)
  59. callbacks.Register("Draw", handler)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement