I am trying to create a votekick system to kick abusing players.
I can’t create a votekick system or modify an already existing one due to roblox updates breaking scripts.
I tried to modify an older votekicking system but to no avail.
I am trying to create a votekick system to kick abusing players.
I can’t create a votekick system or modify an already existing one due to roblox updates breaking scripts.
I tried to modify an older votekicking system but to no avail.
The player should have a gui to vote a player and the vote gets sent to the server. The server gets the vote and waits for a majority of votes or a certain amount of time before kicking the player with the most votes.
The ideal system should be that all players receiving a prompt to vote, where the input will be translated by a script(what they voted) and add them to a table, firing a RemoteEvent
. Also it’s optional to add a catcher(when new players join, prompt them too in the duration - which can be a little complex with server having to recalculate the votes and update the GUI).
The server will have to calculate the number of players and determine the majority of a server(such as 3/5 votes or 9/20, it’s up to you).
Upon receiving the votes from the client, they will add up to the number value of x
which will eventually reach to the target amount of votes to proceed. Sufficient votes, if x >= targetNumber
, will immediately fire a Player:Kick()
on the target player before timer runs out. Votekick window closes.
When timer goes out, and it’s not sufficient votes, it will close all the clients votekick window. The game will not be interrupted by this. As the script is either separate or part of a module using spawn(function())
.
Yes, there’s just one thing that i don’t understand, how the 2 scripts should communicate with themselves?
The GUI has a LocalScript
, which will communicate with the server script using a RemoteEvent
. FilteringEnabled stops the major part of exploiters; read about it here. Both buttons has connected the click, MouseButton1Click:Connect(function)
, where the process begins.
The function you seek is RemoteEvent:FireServer(vote)
, which the vote is either a boolean or a string that is what the player voted. The button each has bound to a function when activated will pass the vote to the server.
Server reads the vote, aka the argument. The vote is added up to the value x
or not if the vote was not true.
Also the prompt of votekick is sent from client to server. Which is another additional step. Server reads the RemoteEvent
arguments, which will then find the target player.
Server will later on fire prompt to all clients to votekick.
So, something like this?
Localscript sends a remotevent with the player which is to be kicked.
A Script then gets the remotevent and starts the voting, sending a option to kick the player or to not kick the player, along with player name of course.
Localscript then can send if the player is to be kicked or if it’s not to be kicked
Script receives all the votes, and calculates a majority, then announces if the player was kicked or not, and finally kicks the player.
Nice, thank you
Ok, i’ve made some serious progress in my votekick system, but there’s still something i can’t decide: what should be the votation time? for now i have 30 seconds
I’d say 1-2 mins, as people are busy with their own game, and 30 seconds in my opinion is simply too little.
WOW, that was pretty fast, anyway, going with 1 minutes and a half!
Here to help anytime!
When i finish with this system, i will modify it to be a free model, going to do that because most votekick system use the chat, and the only one that i found that doesn’t use the chat was not designed for FilteringEnabled.
So, i have run into another setback, i need a way to register who already casted a vote, due to the fact that a exploiter could mass-vote yes or no. But i have no idea how to register everything on a single variable.
Just make a table on the server, and if the person has not voted before, add their name to the table. If they have, then just end. For every value added, you can also check if enough players voted the exploiter to be kicked, and if it is enough, kick the exploiter.
There is more effective ways on diong this, take this as an example.
Interesting… can you explain a bit more about tables?
When you create a vote player script, you want to make it so there’s a variable of a number for every player. Such as this (This is a more old fashioned way of doing it);
game.Players.PlayerAdded:Connect(function(player)
local voteValue = Instance.new("IntValue")
voteValue.Parent = player
end)
If you have this, it will add a value inside of each player. If the player doesn’t get voted after a certain amount of seconds reset the vote count to 0. If a player leaves subtract it -1, and if a player removes their vote -1. I think you get the picture.
Thanks for the help, going to see what i can do with that information!
No problem, also when a player votes make the value go up by 1 and if it reaches a certain amount of votes such as this kick em and it should do the trick;
local max = 5
if voteValue.Value > max then player:Kick() end
Also make it so if someone else votes the player make it so it resets the timer back to 50 seconds each time, it’s just a more simple way to do it.
I am now having the following problem: i don’t want the player who is votekicking against a player to be able to see the pop-up asking if that player should be kicked, and the player who is being voted to be kicked off the game, so i did this:
PlayerName = game.Players.LocalPlayer.name
local function OnVoteStart(SendPlayer, ply, rso)
if PlayerName ~= SendPlayer or ply then
print(SendPlayer .. ply .. rso .. "client")
Description.Text = SendPlayer .. " Wants to kick " .. ply .. " For the following reason(s): " .. rso .. " Should he/she be kicked?"
MainFrame:TweenPosition(UDim2.new(0, 0,0, 0),"Out","Quint",0.3,true)
end
end
The problem is that the check seems to be ignored. Any Ideas to fix this?