Should I relocate some internals of this script to prevent exploiting?

Hello! I have this localscript within starterCharacter that tells the player when to change it’s camera type. Along with that, there’s also a few lines that changes the player speed.

For reference, here is the script:

local player = game.Players.LocalPlayer
game.Workspace.GameMusic.Playing = false
game.Workspace.LobbyMusic.Playing = true
game.Workspace.LobbyMusic.TimePosition = 0
player.PlayerGui.ScreenGui.Points.Plus.Visible = false
local character = player.Character or player.CharacterAdded:Wait() 
local humanoid = character:WaitForChild("Humanoid")
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = game.Workspace.testlol
camera.CFrame = game.workspace.testlol.CFrame
humanoid.WalkSpeed = 0
humanoid.JumpPower = 30
player.PlayerGui.ScreenGui.Points.Visible = false
player.PlayerGui.ScreenGui.Button.Visible = true
player.PlayerGui.TeleportButton.Teleport.Visible = true
	if game.Workspace.InGame.Value == 1 then
	player.PlayerGui.ScreenGui.Button.Visible = false
	player.PlayerGui.ScreenGui.SpectateMenu.Visible = false
	player.PlayerGui.ShopGui.Enabled = false
	player.PlayerGui.ScreenGui.Close.Visible = false
	player.PlayerGui.ScreenGui.Points.Visible = true
	player.PlayerGui.TeleportButton.Teleport.Visible = false
	humanoid.WalkSpeed = 20.5
    humanoid.JumpPower = 30
    camera.CameraType = Enum.CameraType.Follow
    camera.CameraSubject = humanoid
    player.CameraMode = "LockFirstPerson"

As you can see, this changes the player speed too. The issue though is that this is a localscript, so my concern is that exploiters could easily just change 0 or 20.5 to something insane like 50. I was considering making a remoteFunction and the server changes the speed for the character, but in all reality couldn’t the exploiter simply add a line of code changing player speed anyways within the localscript? In that case I don’t really see the point in going through all of that trouble, but I wanted to come here to get y’alls opinions.

1 Like

The issue wouldn’t be in your LocalScript. Exploiters can already execute their own code, so they are able to set the WalkSpeed themselves whether or not you have logic for it in your own scripts. If you want the character to really stay in place you’ll need some kind of server check on the character’s location so that it doesn’t change drastically. Alternatively you could anchor parts of the character in place, but I don’t know if clients can locally override this.

1 Like

Ok, cool. I’ll just simply use GetPlayers() at the end of each wave and kick anyone who is above 20.5 I guess.