|
| 05 Feb 2014 07:50 PM |
admin = ("Fearlessblocky202") game.Players.PlayerAdded:connect(function(newPlayer) if newPlayer:GetRankInGroup(758417) < 200 and newPlayer ~= admin then script.Parent:remove() end end)
I want this script to remove the parent, which is a GUI, of all players not above the rank of 200 and not an admin in that particular group. The admin part is so that people that are not in this group can be chosen to view the GUI. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2014 07:56 PM |
Hehehe used to mess me up all the time
if newPlayer:GetRankInGroup(758417) < 200 and newPlayer ~= admin then
and newPlayer ~= admin
newPlayer
newPlayer.Name -- There you go |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Feb 2014 07:21 PM |
And if newPlayer:GetRankInGroup(758417) < 200 and newPlayer ~= admin then
and newPlayer ~= admin
Why would I put "and NewPlayer ~= admin" twice? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:24 PM |
He meant to use newPlayer.Name ~= admin
I think.
Because newPlayer is the player that joined, not a String. You would use newPlayer.Name ~= admin.
It would check if the player's name isn't equal to the variable 'admin' instead of the player itself isn't equal to 'admin'.
Understand now..? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:28 PM |
| I think so. I put newPlayer.Name because the name is on the admin list I have, right? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:29 PM |
| Also, I tested the script without the admin part, and that part doesn't work either. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:30 PM |
Yes.
Let's say a player named LittleJohnny joins your game.
newPlayer = game.Players.LittleJohnny
newPlayer.Name = game.Players.LittleJohnny.Name
So,
if newPlayer.Name ~= admin then --This should be correct. |
|
|
| Report Abuse |
|
|
sk8t3r230
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 8649 |
|
| |
|
|
| 06 Feb 2014 07:31 PM |
admin = "Fearlessblocky202" game.Players.PlayerAdded:connect(function(newPlayer) if newPlayer:GetRankInGroup(758417) < 200 and newPlayer.Name ~= admin then script.Parent:Destroy() end end)
--This didn't work..? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:32 PM |
@sk8,
The first end is for the 'if' statement.
The second end) is for the function. |
|
|
| Report Abuse |
|
|
sk8t3r230
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 8649 |
|
|
| 06 Feb 2014 07:33 PM |
| I'm quite new, but I thought it was because it was in the same line. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:34 PM |
| Ok. That part is fixed now, but the actual removing script part is broken. I tested this and it did not work. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:36 PM |
| Wait wait wait. Would this be a local script or no? |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Feb 2014 07:49 PM |
| ERMAGOSH THE SCRIPT WON'T WORK! |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 06 Feb 2014 07:52 PM |
you compared a name to a table
admin = "Fearlessblocky202" game.Players.PlayerAdded:connect(function(newPlayer) if newPlayer:GetRankInGroup(758417) < 200 and newPlayer.Name ~= admin then -- script.Parent:remove() --removed due to being dumb
newPlayer:Kick() end end)
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:52 PM |
No. It shouldn't be a LocalScript.
Make a separate script(Make sure you name it Script2), in the same Parent as this one.
Then put a BoolValue into the NEW script. Make the value false.
In the new script, insert this;
repeat wait() until script.BoolValue.Value == true script.Parent:Destroy()
--Now, use this in the original script.
admin = ("Fearlessblocky202") game.Players.PlayerAdded:connect(function(newPlayer) if newPlayer:GetRankInGroup(758417) < 200 and newPlayer.Name ~= admin then script.Parent.Script2.BoolValue.Value = true end end)
--This should work if you follow the directions correctly..? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:53 PM |
@lolb,
I don't think he's trying to remove the new player from the game. Also, I've never heard of the Kick() method. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 06 Feb 2014 07:54 PM |
if newPlayer:GetRankInGroup(758417) < 200 or newPlayer ~= admin then
I'm pretty sure you wanted OR |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:55 PM |
So apparently, the Kick() method is a better way of completely removing a player from the game. This should come in handy to stop future exploiters who can still exploit when their player is removed.
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 07:55 PM |
| If this script is in a GUI that is being replicated to the players you don`t use PlayerAdded. |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 06 Feb 2014 08:01 PM |
| again, you're comparing his name to a table, unless you are referencing my post. and removing the script's parent will stop the script from working more than once |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 06 Feb 2014 08:06 PM |
'admin = ("Fearlessblocky202")' not a table... |
|
|
| Report Abuse |
|
|