|
| 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 |
|
|
| |
|
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 |
|
|
| |
|
Misteroe
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 6839 |
|
| |
|
|
| 10 Nov 2013 12:02 PM |
"Ignorance"
much scripting powers |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 6839 |
|
|
| 10 Nov 2013 12:04 PM |
yes im 1333337 anonymous hacker im god lol |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2013 01:24 PM |
| you are missing an end -.- |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2013 01:25 PM |
@cntkillme No, when using elseif, you don't need an end on the if statement. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|