|
| 25 Feb 2016 02:30 PM |
So I'm trying to make a WhiteList, but I can't figure out how to search all the values within a table/string. Here is my script:
local list = game.Players
local WhiteList = { "Player", "Player1" }
if script.Parent.Name == "PlayerGui" then local plr = script.Parent.Parent while true do if plr.Name ~= WhiteList then plr:Kick("You are not WhiteListed.") end wait() end end
--//
When I tried to enter the game (test mode), it said that my character was loading, and then studio crashed.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:35 PM |
I feel like the answer is extremely obvious, but I'm missing it somehow.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:38 PM |
Put this directly in StarterGui (LocalScript).
local p = game.Players.LocalPlayer
local pl = { Player=true; MightyDantheman=true; }
if not pl[p.Name] then p:Kick("You are not whitelisted.") end
-MetallicFrog | 15,000 posts | Scripter | Builder | |
|
|
| Report Abuse |
|
|
ElectroTM
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 1135 |
|
|
| 25 Feb 2016 02:38 PM |
I don't see the need to have a while loop in there...
y-y-you too... |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:41 PM |
You're right, I don't need a whileloop. But that script you gave me, although it does work, it still doesn't give the kick message, and crashed studio when stopping the test. I do have another idea though, hold on.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:42 PM |
Kick messages only show in online mode, and it will crash because it tries to remove an already kicked player. Online mode WILL work fine.
-MetallicFrog | 15,000 posts | Scripter | Builder | |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:45 PM |
Alright, thanks. I did replace it with ":Destroy()" and it didn't crash in Studio, but I guess I'll switch to back. Btw, would kicking the player be better than destroying it (from the playerlist)? Or would kicking the player do the same, but with the message?
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:46 PM |
They both disconnect the client, but Kick is preferred. Your call.
-MetallicFrog | 15,000 posts | Scripter | Builder | |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:46 PM |
If you :destroy() a player they are still connected to the server. :kick() will disconnect them. |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:46 PM |
'They both disconnect the client, but Kick is preferred. Your call. Wrong, if you :destroy() a player they are still connected. |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 02:58 PM |
In server script service
local whiteList = { "Player", "Player1" } game.Players.PlayerAdded:connect(function(player) local shouldKick = true for i = 1,#whiteList do if whiteList[i] == player.Name then shouldKick = false break end end if shouldKick == true then player:Kick("You are not White Listed!") end end)
The only thing I want is the last thing I need |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 03:25 PM |
@128
"Sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children." keyword: disconnect
-MetallicFrog | 15,000 posts | Scripter | Builder | |
|
|
| Report Abuse |
|
|
TaaRt
|
  |
| Joined: 26 Apr 2009 |
| Total Posts: 5039 |
|
|
| 25 Feb 2016 03:26 PM |
| all connections to events, it doesn't remove the client replicator object attached as that's not an event |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 03:27 PM |
Go call destroy in studio and see if anything still registers for you. Trust me, it doesn't. I have had it done on me before.
-MetallicFrog | 15,000 posts | Scripter | Builder | |
|
|
| Report Abuse |
|
|
TaaRt
|
  |
| Joined: 26 Apr 2009 |
| Total Posts: 5039 |
|
|
| 25 Feb 2016 03:28 PM |
| not sure what kind of authority you are, but I don't trust you there. A client replicator is an object acting as a socket for the attached client, it has no direct link to the player object as it can exist without just fine |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 03:31 PM |
Yes, but for all intents and purposes, they will not see any new changes in the game.
-MetallicFrog | 15,000 posts | Scripter | Builder | |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 03:31 PM |
Let me ask you guys this, if you destroy the player from the player list, will it still count the player as connected to the server? That's the only thing I'm concerned about.
~MightyDantheman |
|
|
| Report Abuse |
|
|
TaaRt
|
  |
| Joined: 26 Apr 2009 |
| Total Posts: 5039 |
|
|
| 25 Feb 2016 03:32 PM |
| the client remains connected, the player won't exist anymore |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2016 03:35 PM |
Kick() it is then.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2016 06:38 AM |
Its disconnects all events and references to the object it does not disconnect the connection to the server. If you destroy them, they will still see the chat, and be able to watch people do things. And more importantly be able to exploit the game.
Testing this with 1 player is not accurate because the server itself shuts down when it things there are no players in the game. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2016 09:12 PM |
local whitelist = {["Player"] = true, ["wewewedgfdsgfdg"] = true}
game.Players.PlayerAdded:connect(function(plr)
if whitelist[plr.Name] then plr:Kick() end
end)
xCL_ |
|
|
| Report Abuse |
|
|
ElectroTM
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 1135 |
|
|
| 26 Feb 2016 09:19 PM |
^ that kicks players for being on the whitelist.
y-y-you too... |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2016 09:22 PM |
@block, whoops, thanks for noticing my mistake, I am half asleep at the moment.
local whitelist = {["Player"] = true, ["rhghgfdfgfrgr"] = true}
game.Players.PlayerAdded:connect(function(plr)
if whitelist[plr.Name] then print(plr.Name.." Is Whitelisted") else print(plr..Name.." Isn't Whitelisted") plr:Kick("Bon Voyage!") end end)
xCL_ |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2016 09:22 PM |
accidently added a extra dot, beware of that
xCL_ |
|
|
| Report Abuse |
|
|
Crimsonal
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1795 |
|
|
| 26 Feb 2016 09:24 PM |
local Whitelist = {}
function searchTable(table, string) for i,v in next,table do if v:lower() == string:lower() then return true end end return false end
game.Players.PlayerAdded:connect(function(Player) if not searchTable(Whitelist, Player.Name) then Player:Kick() end end |
|
|
| Report Abuse |
|
|