Problems with passing Table Data through function?

ok, so.

I’ve been messing around with this for the past 30 minutes.

Here’s the error:

15:05:16.637  HumanoidRootPart  -  Server - Actions:43
  15:05:16.638  nil  -  Server - Actions:44
  15:05:16.638  ServerScriptService.Handler.Actions:47: attempt to index nil with 'WaitForChild'  -  Server - Actions:47

Explanation:
For some reason when i pass only Data[2] and Data[3] It Errors and Doesn’t get passed the right Data.
But when i pass all 4 bits of data, (Data[1 - 4]) it functions normally.

Why is this?!?! This is so annoying!


^ Video of the issue here.

Any help is greatly appreciated!

(if you need any more information don’t hesitate to ask! :smile:)

2 Likes

Can you post just the client and server side of the call that is erroring as text?

hum is nil. You’re not passing hum, to the dash method.
Also, passing data through remotes is restricted to certain types, afaik you can’t pass functions or objects.

ServerScriptService.Handler.Actions:41: attempt to index nil with 'WaitForChild'

this?

What exactly Do you mean?

Post the full function that that error occurs in, and also the function which calls that function. If the issue you’re having is indeed to do with passing a table between them, that’s what you’d need to look at.

that’s the problem, i am.
the data gets mixed and doesn’t work properly even when passing the correct values.

i’m only passing a table with strings.

  • Post the full function that that error occurs in,
function action:dash(rootpart, hum)
	--	if rootpart and self.isRunning then
		local dash = hum:LoadAnimation(hum:WaitForChild("Dash"))
		dash:Play()

		local dashVelocity = Instance.new("BodyVelocity")
		dashVelocity.MaxForce = Vector3.new(999999,999999,999999)
		dashVelocity.Parent = rootpart


		task.delay(0.175, function()
			dashVelocity:Destroy()
		end)
	--end
end
  • and also the function which calls that function
uis.JumpRequest:Connect(function()
	event:FireServer({"Action", "dash", character:FindFirstChild("HumanoidRootPart"), hum})
	print("Made the request?")
end)

You are firing the remote with one argument. Don’t forget that when sending an event from Client to Server, the Player is inserted as the first argument. Pause in your dash function and you should see that “rootpart” is actually of type player. The second argument (hum) should be a table. But since that isn’t happening, probably the call is not coming from where you expect. Pause in the dash function and check what is actually passed?

Use the </> option to post your code. I don’t even look at pictures or videos of scripts.
Make it easy for people to help you with just a simple copy I can then look over in the Studio.
Also not interested in a small section of your code when bug chasing. Need enough to fully look at the problem.

in the module the function uses colon notation but the way you call it is the equivalent of it using dot notation.

2 Likes

this was the problem!
Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.