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 » Scripters
Home Search
 

Re: this wont work because lua is drunk

Previous Thread :: Next Thread 
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
08 Sep 2015 08:52 PM

function p()
print()
end
function Night1()
p()
end
function Night2()
p()
end
function Night3()
p()
end
function Night4()
p()
end
game.Players.PlayerAdded:connect(function(p)
local nights = {Night1, Night2, Night3, Night4}
nights[1]()

end)

am i using bad syntax

https://www.youtube.com/watch?v=-AvRvI9Klu0&t=159s
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Sep 2015 08:55 PM
It looks fine. Your indentation is off, but it's nothing that would prevent it from working.
Report Abuse
popomcnuggets is not online. popomcnuggets
Joined: 26 Mar 2012
Total Posts: 3680
08 Sep 2015 09:16 PM
not only is it horrendously simple but yes, you are



MY SIDES HAVE LEFT THE GALAXY
Report Abuse
popomcnuggets is not online. popomcnuggets
Joined: 26 Mar 2012
Total Posts: 3680
08 Sep 2015 09:57 PM
you also don't really need that table. since the functions are already there



MY SIDES HAVE LEFT THE GALAXY
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
08 Sep 2015 10:17 PM
Well I'm not a techy, but it could be because the value for player (p) is the same as the name for the function
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
08 Sep 2015 10:18 PM
The indenting was bothering me

function p()
print()
end
function Night1()
p()
end
function Night2()
p()
end
function Night3()
p()
end
function Night4()
p()
end
game.Players.PlayerAdded:connect(function(p)
local nights = {Night1, Night2, Night3, Night4}
nights[1]()
end)
Report Abuse
Everment is not online. Everment
Joined: 08 Oct 2009
Total Posts: 6020
08 Sep 2015 10:21 PM
@mr: p only is defined in it's scope; it doesn't extend to an exterior function's scope (that's not the issue)

@op: assuming you actually put something inside of your print and your script is a normal script that actually runs on the server, that script works. (for reference playeradded doesn't fire on the client last i recall)
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
08 Sep 2015 10:24 PM
Thats what I thought, lua would never error with that, but we are dealing with roblox here e.e
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
09 Sep 2015 07:34 PM
I removed the event handler and pasted all the code without the event part in the lua interpreter
didnt work
Report Abuse
popomcnuggets is not online. popomcnuggets
Joined: 26 Mar 2012
Total Posts: 3680
13 Sep 2015 10:00 PM
never use tables for functions



MY SIDES HAVE LEFT THE GALAXY
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
13 Sep 2015 10:03 PM
local function p()
print("WOA")
end
local nights = {
["Night1"] = function()
p()
end;
["Night2"] = function()
p()
end;
["Night3"] = function()
p()
end;
["Night4"] = function()
p()
end;
["Night5"] = function()
p()
end;
}

game.Players.PlayerAdded:connect(function(p)
nights[1]()
end)

#code return
Report Abuse
RiftTalon is not online. RiftTalon
Joined: 02 Dec 2009
Total Posts: 405
13 Sep 2015 10:10 PM
-- This is all you need, nothing else.

function p()
print()
end

game.Players.PlayerAdded:connect(function()
p()
end)

-- Also, your script serves no purpose. :/
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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