Is there any way to know if a module is called from a client or server?

I figured you can check for the existence of ServerStorage but I was wondering if there way any dedicated way to check for this.

PS: One thing I noticed: in studio, ServerStorage exists client sided but it has no children, while in game it’s nil

RunService:IsClient() or RunService:IsServer()
Also, ServerStorage exists on both client/server, though it would be empty on the client.

3 Likes

I figured everything out already but at least I found out about a small studio client vs in game client difference

I assumed it existed online, interesting.

I did too, I coded it like this to check if it’s the server

if #game.ServerStorage:GetChildren() > 1 then 
--thing
end

turns out this would work just fine in studio but error in game

That actually might just be the method you are using to access ServerStorage, :GetService() could initialize it.