Attempted to call require with invalid arguments

Getting the error:

Attempted to call require with invalid arguments

And dont know what is wrong with it, this is the code the error says is wrong:

local DataManager = require(game.ReplicatedStorage.DataManager)

2 Likes

Are you sure that DataManager is a module script?

I’ll triple check, the tutorial I watched said so, but maybe I screwed something up.

The error that you’re getting is basically saying that the Instance in ReplicatedStorage called DataManager is not a Module Script

Ok that fixed but now there is a new error:

attempt to call missing method ‘Get’ of table

which is saying this line of code is wrong:

local data = DataManager:Get(Player)

This profile service stuff is new to me, so im living of tutorials right now lol, have no idea whats wrong.

That error message means that the Module Script, Data Manager, is missing the method Get from it, while I haven’t used Profile Service and I don’t know the methods that come with it, I can only assume that you had a Capitalization error with either naming or calling your method.

Learned something today, im stupid. I made the Data Manger a normal script, not a module script :weary:

2 Likes

Update: Found new errors, they are all coming from profile service

DataStore can’t be accessed from client

BindToClose can only be called on the server.

local scripts can’t use DataStore, you need to use a server script

same thing, BindToClose is server-side only

Ok, but then how am I supposed to use my data in a local script?

remote functions. You could invoke the server from the local script to retrieve the data you desire. Remote Function | Invoke Server
Also, for a more comprehensive guide, check out Remote Events and Callbacks | Documentation - Roblox Creator Hub

1 Like

oky dokey, set that up but for one script I got a problem, I dont know how to start the invoke thing without exhausting an remote function because it fires every time the player moves.

use RemoteEvents, there is no point of using RemoteFunction unless the client needs to return a value

1 Like