Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local votekickCmd = "!votekick"
- local cooldown = 60
- local plrsOnCooldown = {}
- local timeForVote = 10
- local isVotingForKick = false
- local plrsVoted = {}
- local votesForKick = 0
- local systemMsgRE = game.ReplicatedStorage:WaitForChild("CreateSystemMessage")
- game.Players.PlayerAdded:Connect(function(plr)
- plr.Chatted:Connect(function(msg)
- if string.sub(msg, 1, string.len(votekickCmd)) == votekickCmd and not isVotingForKick then
- local plrVoted = game.Players:FindFirstChild(string.sub(msg, string.len(votekickCmd) + 2))
- if plrVoted and not plrsOnCooldown[plr] then
- plrsOnCooldown[plr] = true
- isVotingForKick = true
- votesForKick = 0
- systemMsgRE:FireAllClients("[VOTEKICK] Type 'yes' to vote for " .. plrVoted.Name .. " to be kicked. Type 'no' to ignore the vote.")
- wait(timeForVote)
- isVotingForKick = false
- if votesForKick >= math.ceil(#game.Players:GetPlayers()/2) then plrVoted:Kick("You have been votekicked") end
- wait(cooldown - timeForVote)
- plrsOnCooldown[plr] = nil
- end
- elseif isVotingForKick then
- if msg == "yes" then
- if plrsVoted[plr] ~= "yes" then
- votesForKick = votesForKick + 1
- end
- plrsVoted[plr] = "yes"
- elseif msg == "no" then
- if plrsVoted[plr] == "yes" then
- votesForKick = votesForKick - 1
- end
- plrsVoted[plr] = "no"
- end
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement