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: Help with this script?

Previous Thread :: Next Thread 
Unradiated is not online. Unradiated
Joined: 27 Oct 2013
Total Posts: 485
10 Nov 2013 11:35 AM
function PlayerAdded(p)
if script.Parent.Configuration.RegisterPlayers.Value == true then
p.Character.Humanoid.WalkSpeed = 0
script.Parent.Name = "A player has entered! Registering player..."
wait(5)
p.Character.Humanoid.Health = 0
script.Parent.Name = "Registered "..p.Name.." successfully."
wait(3)
script.Parent.Name = "Server is ready!"
end
elseif script.Parent.Configuration.RegisterPlayers.Value == false then
print("Registering players has been disabled.")
end

game.Players.PlayerAdded:connect(PlayerAdded)

It says the "elseif" has an error in it, but I have no idea whats wrong.
Report Abuse
Unradiated is not online. Unradiated
Joined: 27 Oct 2013
Total Posts: 485
10 Nov 2013 11:43 AM
b1
Report Abuse
Misteroe is not online. Misteroe
Joined: 05 Aug 2010
Total Posts: 6839
10 Nov 2013 11:51 AM
ok i fixed

function PlayerAdded(p)
if script.Parent.Configuration.RegisterPlayers.Value == true then
p.Character.Humanoid.WalkSpeed = 0
script.Parent.Name = "A player has entered! Registering player..."
wait(5)
p.Kid.Humanoid.Ignorance = 100
script.Parent.Stupid = "Registered "NoName.." Failiure."
wait(3)
script.Parent.Name = "Server is ready!"
end
elseif script.Parent.Configuration.RegisterPlayers.Value == false then
print("Registering players has been disabled.")
end

game.Players.PlayerNubbed:successful(PlayerAdded)


ther u go bbycakes <3
Report Abuse
Unradiated is not online. Unradiated
Joined: 27 Oct 2013
Total Posts: 485
10 Nov 2013 11:58 AM
misteroe pls
Report Abuse
Misteroe is not online. Misteroe
Joined: 05 Aug 2010
Total Posts: 6839
10 Nov 2013 12:00 PM
u said wot m8
Report Abuse
Unradiated is not online. Unradiated
Joined: 27 Oct 2013
Total Posts: 485
10 Nov 2013 12:02 PM
"Ignorance"

much scripting powers
Report Abuse
Kaffeine is not online. Kaffeine
Joined: 27 Oct 2013
Total Posts: 230
10 Nov 2013 12:02 PM
Just so you know, and don't make the same mistake again (because giving people fixed scripts don't give them knowledge), if you have an 'if' and 'elseif' statement, you end them with one end.

i.e.

if bleh then
blah
elseif bloh
blih
end
Report Abuse
Misteroe is not online. Misteroe
Joined: 05 Aug 2010
Total Posts: 6839
10 Nov 2013 12:04 PM
yes
im 1333337 anonymous hacker
im god lol
Report Abuse
Unradiated is not online. Unradiated
Joined: 27 Oct 2013
Total Posts: 485
10 Nov 2013 01:23 PM
Ok, I fixed the script, but it says the :connect part is wrong.

function PlayerRegistered(p)
if script.Parent.Configuration.RegisterPlayers.Value == true then
p.Character.Humanoid.WalkSpeed = 0
script.Parent.Name = "A player has entered! Registering player..."
wait(5)
p.Character.Humanoid.Health = 0
script.Parent.Name = "Registered "..p.Name.." successfully."
wait(3)
script.Parent.Name = "Server is ready!"
elseif script.Parent.Configuration.RegisterPlayers.Value == false then
print("Registering players has been disabled.")
end

game.Players.PlayerAdded:connect(PlayerRegistered)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2013 01:24 PM
you are missing an end -.-
Report Abuse
Unradiated is not online. Unradiated
Joined: 27 Oct 2013
Total Posts: 485
10 Nov 2013 01:25 PM
@cntkillme
No, when using elseif, you don't need an end on the if statement.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2013 01:26 PM
Yes you do
Report Abuse
Unradiated is not online. Unradiated
Joined: 27 Oct 2013
Total Posts: 485
10 Nov 2013 01:28 PM
Just copied this from the wiki. Read it and weep.

'Elseif' is not an 'if' function. So what is the difference between 'elseif' and 'else if'? 'Elseif' is counted as an 'else' with a requirement for it to be run, and doesn't need an end. On the other hand, 'else if' is comprised of two statements: an else, and an if. Therefore, it needs a 'end' for the extra 'if' statement. 'Elseif' is A secure than 'else', because the lines of script after it only runs if the condition after the 'elseif' is met. Unless you want the following lines to be run only if the 'if' statement is false, then use 'elseif' to make sure that the lines only run if the 'elseif' condition is met.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2013 01:40 PM
Nope, you are so wrong, and so is the wiki

if, elseif, and else if are not functions, they are conditional statements, and with every if, there must be a matching end

if x then
elseif y then
end

You need 1 end there

if x then
else
if y then
end
end

you need 2 ends there


You forgot to add an end for not closing your statement
Report Abuse
Kaffeine is not online. Kaffeine
Joined: 27 Oct 2013
Total Posts: 230
10 Nov 2013 01:41 PM
Think of it this way, the "elseif" doesn't need an end, but the "if" needs an end, and the only place you can put it is after "elseif".
Therefore, you are missing an end.
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