local hlFunc = game:GetService("ReplicatedStorage").Remotes:WaitForChild("hlFunc"):InvokeClient(player) return hlFunc
This is inside a normal function inside of a modulescript and it says i cant use InvokeClient() on the server, and then when i put in InvokeServer its vice versa.
When you are using a ModuleScript, the module will be ran by the type of script that you require it with. So say you ran
--/Server Script local hlFunc = require(game:GetService("ServerStorage"):FindFirstChild("ModuleScript"));
That would allow you to run it as a Server Script and allow the ModuleScript to run InvokeClient(), whereas requiring it from a LocalScript will run it as a LocalScript from whichever player's client the script is on (All of them unless you only put it in a certain player)
--/Local Script local hlFunc = require(game:GetService("ServerStorage"):FindFirstChild("ModuleScript"));
Requiring it in the LocalScript would error because you cannot run InvokeClient() from a client.
If this help, that's awesome! If it didn't and you're still confused feel free to ask any other questions to have about it, or ask me to clarify what confused you.
Well, because remote events can't be invoked as they aren't remote functions, but they can be fired with the FireServer(), FireClient, and FireAllClients() functions. Then they can be recieved by other scripts or local scripts with the OnServerEvent(), and OnClientEvent events. Ex:
--local script local re = game.ReplicatedStorage.RemoteEvent re:FireServer("ding") --server script local re = game.ReplicatedStorage.RemoteEvent re.OnServerEvent:Connect(function(plr,thing) print(plr.Name,thing) end)
I think what you are trying to do the invoke a remote function and doing that looks something like:
--local script local rf = game.ReplicatedStorage.RemoteFunction local ding = rf:InvokeServer("Dab") print(ding)--3 --server script local rf = game.ReplicatedStorage.RemoteFunction rf.OnServerInvoke = function (plr,thing) return #thing end