Zmann

Murder Mystery 2 Script

Aug 1st, 2018
39,536
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Z for Murderer and X for Sheriff, Enjoy!
  2. local er = false
  3. local Mouse = game:GetService"Players".LocalPlayer:GetMouse()
  4. local player = game.Players:GetChildren()
  5. workspace.ChildAdded:connect(function(child)
  6. if child.Name == "GunDrop" then
  7. local cb = Instance.new("BindableFunction")
  8. cb.OnInvoke = function(arg)
  9. if arg == "Get gun!" then
  10. workspace.GunDrop.CFrame = CFrame.new(game.Players.LocalPlayer.Character.Head.Position)
  11. end
  12. end
  13. game:GetService("StarterGui"):SetCore("SendNotification",{
  14. Title = "The sheriff has died!",
  15. Text = "Grab their gun?",
  16. Duration = 5,
  17. Button1 = "Dismiss",
  18. Button2 = "Get gun!",
  19. Callback = cb
  20. })
  21. end
  22. end)
  23.  
  24. Mouse.KeyDown:Connect(function(Key)
  25. if Key == "x" then
  26. for i=1,#player do
  27. local USERID = game.Players:GetUserIdFromNameAsync(player[i].Name)
  28. local gun = player[i].Backpack:FindFirstChild("Gun")
  29. local revolver = player[i].Backpack:FindFirstChild("Revolver")
  30. if gun ~= nil or revolver ~= nil then
  31. game:GetService("StarterGui"):SetCore("SendNotification",{
  32. Title = "Sheriff",
  33. Text = "Their name is " .. player[i].Name .. "!",
  34. Icon = "https://web.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid="..USERID,
  35. Duration = 5,
  36. Button1 = "Dismiss",
  37. })
  38. er = true
  39. elseif gun == nil and revolver == nil and i == #player then
  40. game:GetService("StarterGui"):SetCore("SendNotification",{
  41. Title = "Sheriff",
  42. Text = "No sheriff could be found!",
  43. Duration = 5,
  44. Button1 = "Dismiss",
  45. })
  46. end
  47. if er then
  48. er = false
  49. break
  50. end
  51. end
  52.  
  53. elseif Key == "z" then
  54. for i=1,#player do
  55. local USERID = game.Players:GetUserIdFromNameAsync(player[i].Name)
  56. local knife = player[i].Backpack:FindFirstChild("Knife")
  57. if knife ~= nil then
  58. game:GetService("StarterGui"):SetCore("SendNotification",{
  59. Title = "Murderer",
  60. Text = "Their name is " .. player[i].Name .. "!",
  61. Icon = "https://web.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid="..USERID,
  62. Duration = 5,
  63. Button1 = "Dismiss",
  64. })
  65. er = true
  66. elseif knife == nil and i == #player then
  67. game:GetService("StarterGui"):SetCore("SendNotification",{
  68. Title = "Murderer",
  69. Text = "No murderer could be found!",
  70. Duration = 5,
  71. Button1 = "Dismiss",
  72. })
  73. end
  74. if er then
  75. er = false
  76. break
  77. end
  78. end
  79. end
  80. end)
RAW Paste Data