Invalid argument #3 (string expected, got table) on Module Script

Hello!
I am trying to make a notification system with a module script. This is my first time experimenting with module scripts, so this is why I am creating a post about this.

Whenever I run it without having any parameters needed, it works perfectkly fine.

But whenever I use parameters, it has the output of Players.aswdgsagdb.PlayerGui.SmallNoti.Notifications:7: invalid argument #3 (string expected, got table) - Client - Notifications:7

Heres my code:

ModuleScript

local notifications = {}

function notifications.SendNoti(Text1, Text2)
	local notificationFrame = script.Parent.Section.NotificationFrame
	local newNoti = notificationFrame:Clone()
	newNoti.Parent = script.Parent.Section
	newNoti.Subject.Text = Text1
	newNoti.Description.Text = Text2
	newNoti.Visible = true
	print("Sent Notification!")
end

return notifications

LocalScript:

local notiMod = require(game.Players.LocalPlayer.PlayerGui.SmallNoti.Notifications)
	notiMod:SendNoti("Server", "Test")
	print("passed through whole script!")

If you need the code without the parameters to help me out, I can give it.

Anyone know why it happens and a sloution? Much appreciated.

1 Like

Where does it error?

Please copy the line where it errors

It errors at Line 7 according to the output.

newNoti.Subject.Text = Text1

Try calling the function with a period and not a colon.

notiMod.SendNoti("Server", "Test")

Just try to keep them the same.
If you use a colon in the module script then use a colon for the call and vice versa. Won’t go into the details of what does what, you could find that with some minor research. For the time being, you should be fine using one or the other.

Dang Im blind. I forgot thats how that worked

Works nicely now! Its a first for me making these module scripts, so that explaination will greater my understanding for writing these types of scripts. Thanks for the help.