So I'm trying to learn how to better organize my code and avoid exploits. I've just learned that the character has full network ownership for everything inside of them, which means they can change int values, etc. I was originally going to store these values in the character for ease of access with NPCs and such, but I decided to store them in the player.
However, this now feels very very clunky and weird. My player now not only has a cluster of int values including the ones that are player-specific, but then I'd have to go through and manually check through the player for combat-related events.
Is there a way to check if a script modified something inside the character while the script doing this is not inside the character?
I thought I should put it in the player but then realized that server scripts don't work inside the player. If I put it in the character exploiters can just delete it and then go back to changing values.
This code below is an idea to check if it's there but it won't stop the values from being changed.
game.ReplicatedStorage.events.lightAttack.OnServerEvent:Connect(function(fplr, totalAttackTime) if fplr.Character:FindFirstChild("attacking") and fplr.Character:FindFirstChild("attackType") and fplr.Character:FindFirstChildWhichIsA("Tool") then fplr.Character.attacking.Value = true fplr.char.attackType.Value = 1 wait(totalAttackTime) fplr.char.attacking.Value = false fplr.char.attackType.Value = 0 game.ReplicatedStorage.events.lightAttack:FireClient(fplr) else fplr:Kick("Exploits or Cheats Detected.") end end)