Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Kick system created by crazyman32. Credit does not need to be given. Just use it as you wish.
- -- Just don't take credit for making it. That's a noobish thing to do.
- -- VotesNeeded = NumberOfPlayers / Divider
- -- VotesNeeded is then rounded up to the nearest integer
- local Divider = 1.5
- -- When a player votes to kick someone, this is the amount of time before they are allowed to votes again:
- local TimeBetweenVotes = (5) -- 3 minutes
- ----------------------------------------------------------------------------------------------------------------------------------------------------------------
- script.KickGui.KickPlayer.Divider.Value,script.KickGui.KickPlayer.Time.Value = Divider,TimeBetweenVotes
- script.KickGui.Parent = game:GetService("StarterGui")
- game.Players.PlayerAdded:connect(function(p)
- local vote = Instance.new("IntValue",p)
- vote.Name = "Votes"
- vote.Changed:connect(function(value)
- local needed = math.ceil(game.Players.NumPlayers/Divider)
- if (value >= needed) then
- p:Remove() -- YOU BEEN KICKED FOR ABUSING ECT...
- end
- end)
- local votes = Instance.new("ObjectValue",p)
- votes.Name = "AllVotes"
- local last = Instance.new("NumberValue",p)
- last.Name = "LastVote"
- last.Value = -TimeBetweenVotes
- end)
- game.Players.PlayerRemoving:connect(function(p)
- for _,v in pairs(game.Players:GetPlayers()) do
- if (v:FindFirstChild("AllVotes")) then
- 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.
- if (v2.Value == p) then
- v2:Remove()
- end
- end
- end
- if (v:FindFirstChild("Votes")) then
- 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
- if (v2.Value == p) then
- v2:Remove()
- v.Votes.Value = (v.Votes.Value-1)
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement