I have a Server Script that request the character in to ways:
local character = player.Character or player.CharacterAdded:Wait()
player:DistanceFromCharacter(part.Position)
Can either of these lines of code cause a failure in the script if someone has hacked their character?
FYI: The script works great as is. I just don’t understand enough about what clients can hack that will break Server Scripts. Or, if I can improve these two lines to prevent a failure.
1st line is the correct way of getting a character
2nd line is a way to get a distance between player and part
Hackers cant change anything in the server, other than their character. You will still be able to use Player.Character tho.
Only problem is that they can mess up the position of their character and some properties (walk through walls, fly, speedhack), you should use some form of anticheat to prevent that.
FWIU, script executors (although blocked by Byfron now for the most part so little concerns should be made) executes only localscripts. Unless it uses an unsecured RemoteEvent or methods with arguments without checks, those are fine. Server scripts are held on servers, therefore inaccessible.
Other than that, you should have an anti-teleport as they can mess with Pos/Rot, and anti-walkspeed modification anti-cheat.