First argument of my module function has automatically turned into a table

Yup, just like my title says. First argument of my module function has automatically turned into a table and I have no idea how.

So this is basically the server-side client:

local utilities = require(modules:WaitForChild("Utilities"))

local ringmesh = mesh.RingMesh:Clone()
ringmesh.Parent = workspace.Debris				
ringmesh.CFrame = humanoidrootpart.CFrame * CFrame.new(0,4,0) * CFrame.Angles(0, 0, 0)
utilities:Tween(ringmesh, 1, "Transparency", 1)
utilities:Tween(ringmesh, 1, "Size", Vector3.new(24,6,24))

And this is the Module Code:

function c_utils.Tween(object, duration, property, goal, style, direction)
	local tweengoal = {}
	tweengoal[property] = goal 
	local tweeninfo = TweenInfo.new(duration)
	local tweenplay = tweenservice:Create(object, tweeninfo, tweengoal)
	tweenplay:Play()
	return tweenplay
end;

You see, while I was scripting other things, mid way I realized my other scripts randomly broke and I got this error:

TweenInfo.new first argument expects a number for time

I was confused because the first argument is supposed to be a part and 2nd argument is actually duration, so I did the most logical thing and printed both “object” and “duration” in modules and this is what happened…
image

The first argument literally and randomly turned to a table that contains all my module functions while the 2nd argument is “object” aka “ringmesh” which is supposed to be my first argument.

Is this an issue on my end? I am so frustrated right now and It’s 4:34 am, I would really really appreciate it if someone could possibly help me out on this one.

1 Like

You’re calling the function with the colon operator (:), which is used for calling functions of objects. It just passes the table that the function is part of as the first parameter. Try either changing the operator in your function definition to use the colon operator or calling your function with the dot operator (.).

5 Likes

Thank you so much! I didn’t notice that until now. I should probably get to head because I didn’t notice it at all.

2 Likes