Advertisement
gabiplayz

lol

Jan 30th, 2018
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. -- Kick system created by crazyman32. Credit does not need to be given. Just use it as you wish.
  2. -- Just don't take credit for making it. That's a noobish thing to do.
  3.  
  4.  
  5.  
  6. -- VotesNeeded = NumberOfPlayers / Divider
  7. -- VotesNeeded is then rounded up to the nearest integer
  8. local Divider = 1.5
  9.  
  10.  
  11.  
  12. -- When a player votes to kick someone, this is the amount of time before they are allowed to votes again:
  13. local TimeBetweenVotes = (5) -- 3 minutes
  14.  
  15.  
  16.  
  17. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  18.  
  19. script.KickGui.KickPlayer.Divider.Value,script.KickGui.KickPlayer.Time.Value = Divider,TimeBetweenVotes
  20. script.KickGui.Parent = game:GetService("StarterGui")
  21.  
  22. game.Players.PlayerAdded:connect(function(p)
  23. local vote = Instance.new("IntValue",p)
  24. vote.Name = "Votes"
  25. vote.Changed:connect(function(value)
  26. local needed = math.ceil(game.Players.NumPlayers/Divider)
  27. if (value >= needed) then
  28. p:Remove() -- YOU BEEN KICKED FOR ABUSING ECT...
  29. end
  30. end)
  31. local votes = Instance.new("ObjectValue",p)
  32. votes.Name = "AllVotes"
  33. local last = Instance.new("NumberValue",p)
  34. last.Name = "LastVote"
  35. last.Value = -TimeBetweenVotes
  36. end)
  37.  
  38. game.Players.PlayerRemoving:connect(function(p)
  39. for _,v in pairs(game.Players:GetPlayers()) do
  40. if (v:FindFirstChild("AllVotes")) then
  41. for _,v2 in pairs(v.AllVotes:GetChildren()) do -- If anyone voted to kick you, this will remove any history of that so you don't get re-kicked when you re-enter.
  42. if (v2.Value == p) then
  43. v2:Remove()
  44. end
  45. end
  46. end
  47. if (v:FindFirstChild("Votes")) then
  48. for _,v2 in pairs(v.Votes:GetChildren()) do -- If you voted to kick players, this will take away your vote because you are leaving the server
  49. if (v2.Value == p) then
  50. v2:Remove()
  51. v.Votes.Value = (v.Votes.Value-1)
  52. end
  53. end
  54. end
  55. end
  56. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement