yep they are
Remove the “or ply” and test
Results: VoteKick starter didn’t receive the prompt
When you’re doing the remote event. Send three properties: Who is voting? Yes/No. And the person being kicked
This way on the server you can keep track of who is voting. If duplicate requests are sent by the same player, you can just filter them out and have the first one take effect. You could also compare the RE with the person list on the server and use it as server sided validation.
Done all of that, anyway, the system is almost done, just finishing up some validation checks and UI functions.
Ok, i have ran into another problem when creatin one of my checks, basically i will check for the number of children in Players to get the number of player in-game, just 1 problem:
How do i get the number of children in an instance?
Don’t get the children. You can pull a table of players using TableName = game.Players:GetPlayers()
Or if you just want number of players you could just do #TableName.
Ok! so, i should do something like:
#PlayerNumber = game.Players:GetPlayers()
if #PlayerNumber < 3 then
return[0]
Almost! but you don’t need to hash in the variable name. PlayerNumber = game.Players:getPlayers() should do the job. So what you’re doing is creating a player table of all the players in the server.
Everything else looks good
Updated Version:
PlayerNumber = game.Players:GetPlayers()
if #PlayerNumber < 3 then
return(0)
So, i have to hash PlayerNumber to see the number of keys?
That looks right. The benefit of doing it like this is once you figure out who to kick, you could just call
For x=1, #PlayerNumber do
if PlayerNumber[x] == personWhoNeedtoBeKicked
Then
PlayerNumber[x].Remove
End
End
How much percentage of the votes is needed to kick the player in your case?
Just applied the code into my script, everything is going smooth! Upon testing with both 1 and 2 players, no undesired effects appeared, just one more step to go: Refusing a votekick when one is already in progress. Good thing i already scripted in a variable that contains the information i need
Well, as long as the YES votes are in more quantity than NO votes, the Votation will pass.
I think you should check the amount of players, then to people who didn’t vote make it auto count as “no”. Then you check based on the votes and decide if the player gets kicked or no.
So where/or when is the free model, I could use this in my game.