generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Why won't it work?

Previous Thread :: Next Thread 
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
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
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
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
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
06 Feb 2014 07:17 PM
I don't understand this..
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
06 Feb 2014 07:20 PM
Bump
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
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
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
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
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
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
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
06 Feb 2014 07:29 PM
Also, I tested the script without the admin part, and that part doesn't work either.
Report Abuse
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
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 is not online. sk8t3r230
Joined: 13 Jun 2011
Total Posts: 8649
06 Feb 2014 07:31 PM
end end)?
Report Abuse
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
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
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
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 is not online. 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
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
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
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
06 Feb 2014 07:36 PM
Wait wait wait. Would this be a local script or no?
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
06 Feb 2014 07:40 PM
Bump
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
06 Feb 2014 07:49 PM
ERMAGOSH THE SCRIPT WON'T WORK!
Report Abuse
lolb3 is not online. 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
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
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
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
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 is not online. 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
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Feb 2014 08:06 PM
'admin = ("Fearlessblocky202")'
not a table...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image