Server scripts can not reference the LocalPlayer because they are on the server.
If you need to reference the LocalPlayer, you must use a local script.
There is no definitive way to prevent exploiters from messing with remote events from the client. Instead, you should be doing sanity checks on the server to ensure no data is being sent which shouldn’t be sent.
It isn’t technically, Exploiters can’t open scripts, And if they “delete” the script, They only delete it for themselves, The only diffrence from startergui and serverscriptservice is that exploiters can see the script object.
Still recommend putting everything in serverscriptservice, There’s really 0 need for any serverscripts in startergui + Scripts can’t reference the localplayer, Only localscripts can do that.
Technically you can’t reference “LocalPlayer” by using game.Players.LocalPlayer in a server script, but you still could in server script if it placed in StarterGui:
local plr = script:FindFirstAncestorOfClass('Player')
-Reduce amount of remotes needed = Less Potential Exploiters Spoofing Remote Events/Functions
-No need for server checks as it is already a server script
-Prevents exploiters from changing arguments using hooking methods
Yes I understand that the player reference using the StarterGui methods is on the server. However theirs no risk from firing client from server thus you could just make almost everything server sided.
That is my point, and I was wondering if it would cause any latency issues, since the server scripts will be replicated on the server across all players.
TL;DR
use playeradded, it works the same, is in 1 script instead of every player has 1, its more organized, officially supported by roblox, you can even get the character every time it respawns using it.
Always do your main code/important stuff from the server, doesnt matter if it works fine on the client. You always want to keep your game as secure as possible. I don’t see any reason using PlayerAdded in a localscript. Simply do it on the server and use remotes[do sanity checks].
You cant actually make everything server-sided. I understand what you’re trying to achieve, but it’s not going to work in the way that you think it is.
This isn’t valid because you can’t get data from the client without remote events. No matter what you’re going to need to use remote events unless it’s something physics/network ownership related.
Once again, this is not valid because you can’t get data from the client without remotes. You’re going to have to do checks no matter what.
It is true that exploiters cannot change server code. But once again, it doesn’t matter because none of the code in a server script can actually interact directly with client-related functions.
Since your code is in StarterGui, I assume you’re using it for GUI-related stuff? If so, this is a really bad idea mostly because you cant actually detect any input from the client.
your points were invalid because you’re talking about a localscript which nobody was talking about besides me in my original argument (not even the playeradded one)