Will using an empty return statement in a module script give hackers useful info?

I am adding some sanity checks to some scripts and feel concerned about using a return statement in this module script.

My fear in adding it is that it may actually send info back to a hacker. So I don’t want to add it if it’s not even needed.

-- make sure it's a player
for i, checkPlayers in pairs(Players:GetPlayers()) do
	if recievedCharacter.Name == checkPlayers.Name then
		realPlayer = true
	else
		return -- do nothing
	end
end
1 Like

Why return, and not continue or break? Also, why check the names? You could just use Players:GetPlayerFromCharacter(receivedCharacter). But returning nil, will probably not give the exploiter much, if not any information.

That’s a better approach for confirming it’s a real player. Thanks. :grinning:

I haven’t come across continue. I thought break was for loops?

1 Like

break is like a return, but for loops. It stops the loop completely. continue moves onto the next iteration of the loop.

I was just reading about continue. Do you know if I need the return statement or not? It’s the only way I know to stop the script from moving forward. There is a lot more after checking if the receivedCharacter is actually a real player.

1 Like

I don’t have the proper context, you’d need to figure that one out for yourself. Good luck.

Thanks. I understand what you’re saying about using break to stop the for loop.

But my real question is about using a return after an else statement in a module script.

I probably should have just posted:

   else
      return
   end

as my example.

1 Like

Just writing return exits a function.

Thanks for the help. I will try to less confusing posts in the future.

1 Like

No problem! Your posts weren’t confusing at all!