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: value is "nil" even when properly declared

Previous Thread :: Next Thread 
ArmaVictorem is online. ArmaVictorem
Joined: 18 Mar 2015
Total Posts: 1332
03 Jul 2016 07:09 AM
tool = script.Parent

event = tool:FindFirstChild("RemoteEvent")

event.OnServerEvent:connect(function(player, ...)
local tuple = {...}
if tuple[1] == "FIRE" then
print("Server has been fired!")
end
end)

more importantly It was working 5 minutes ago, I have no idea what is going on.
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
03 Jul 2016 07:13 AM
if you are giving ... as a table, you dont need to make it another one

...(Given)
tuple = {...}

then it might be

{{...}}
Report Abuse
ArmaVictorem is online. ArmaVictorem
Joined: 18 Mar 2015
Total Posts: 1332
03 Jul 2016 07:19 AM
oh sorry it isn't tuple that is nil, it's the variable event
Report Abuse
ArmaVictorem is online. ArmaVictorem
Joined: 18 Mar 2015
Total Posts: 1332
03 Jul 2016 07:36 AM
for some reason removing this block

event.OnServerEvent:connect(function(player, ...)
local tuple = {...}
if tuple[1] == "FIRE" then
print("Server has been fired!")
end
end)

sets event to nil for some reason, is there something wrong with the way I set it up?
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
03 Jul 2016 08:03 AM
local Tool = script.Parent local Event = Tool:FindFirstChild("RemoteEvent")
Event.OnServerEvent:connect(function(Player, ...)
local Arguments = {...}
print(Player)
for Position, Argument in next, Arguments do
if Argument[1] == Argument[Position] and Argument == "FIRE" then
print("Server has been fired!") break
end
end
end)


-=[ RAP: 334,746 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
Titanicman882ftlong is not online. Titanicman882ftlong
Joined: 14 Aug 2012
Total Posts: 430
03 Jul 2016 08:13 AM
^ If it still nils, change in FindFirstChild to WaitForChild.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
03 Jul 2016 09:29 AM
--Server script

local re = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local tool = script.Parent

re.OnServerEvent:connect(function(plr,...)
local tuple = {...}
if tuple[1] == "FIRE" then
print("Server has been fired!")
end
end)

--Local script

local re = game.ReplicatedStorage:WaitForChild("RemoteEvent")

re:FireServer("FIRE","HELLO","YO")


Report Abuse
MaIevoIence is not online. MaIevoIence
Joined: 06 Jul 2014
Total Posts: 21
03 Jul 2016 10:01 AM
WaitForChild did it, thanks

it probably wasn't loaded yet when the script ran
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