How would i pass the varibles through this function?

local ATime
local Intro
local Name
script.AData.Event:Connect(function(NName,NIntro,NATime)
	print(NName)
	print(NIntro)
	print(NATime)
end)

I asked a similar question on an earlier post but didn’t get a resolve so i’m asking here in a more simple way; How would i send the function variables (NNAme,NInro and NATime) outside the function so i can use it? as you can see i already tried that local trick but it does not work. any help?

I’m pretty sure the only way you can do this is to do this

local ATime
local Intro
local Name
local N_Name,N_Intro,NA_Time
script.AData.Event:Connect(function(NName,NIntro,NATime)
	N_Name = NName
	N_Intro = NIntro
	NA_Time = NATime
end)

Otherwise you could just write the rest of the code inside the function

I did try that but then the script would just do nothing, i have no idea why.

Also just tried out what you sent me, the variables are still seen as “Nil” outside the function


i keep getting this error. and if i dont then the script does nothing.

if the variables are set in the function then they shouldn’t appear as nil unless you are printing their value before the function fires.

Yeahh i just looked back and i see the issue i think.

I’m telling the script to fire the event once it’s moved to the workspace. i actually got it to work thanks to you, thank you for your help! :smiley:

No problem! glad I could help :slight_smile: