Setbacks preventing completion of client-sided dash script

I am nearly done with my dash script. But I’ve thought of a couple of issues that I will face in the future in relation to my game that prevent me from finishing it. The game that I am working on is one where bombs

  1. The code is vulnerable to exploiters, who will be able to disable cooldowns, change dash length to their will, or modify the LinearVelocity instance that creates the dash effect so that they can go anywhere. I would make this server sided, but I want my game to be as responsive as it can be.

  2. I want the LinearVelocity to be destroyed if a player is hit by an explosion, but the explosions are server sided—instances added by the client will be invisible to them.

I’ve been searching through the forums for answers and tried to apply the same logic from this post, but I couldn’t find any posts that could’ve helped, and the logic from the post hyperlinked I don’t believe can apply to this.

This is the script for it as of now.

local char = script.Parent
local rootPart = char.PrimaryPart
local humanoid = char:WaitForChild("Humanoid")

local UIS = game:GetService("UserInputService")
local dashMult = 72 + (humanoid.WalkSpeed * 0.5)^1.25

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvents = replicatedStorage:WaitForChild("RemoteEvents")

local effectReplicationRemote = remoteEvents:WaitForChild("effectReplicationRemote")

function applyDashChange(linearVelocity, i)
	local dashVelocity = Vector3.new(rootPart.CFrame.LookVector.X * (dashMult - (i * 10)), 0, rootPart.CFrame.LookVector.Z * (dashMult - (i * 10)))
	
	linearVelocity.VectorVelocity = dashVelocity
end

local avaliableDashes = 3
local debounce = false

UIS.InputBegan:Connect(function(input, gameProcessed)
	if not debounce then
		if input.KeyCode == Enum.KeyCode.LeftShift and avaliableDashes > 0 then
			avaliableDashes -= 1

			local linearVelocity = Instance.new("LinearVelocity")
			linearVelocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
			linearVelocity.MaxAxesForce = Vector3.new(math.huge, 0, math.huge)

			linearVelocity.VectorVelocity = rootPart.CFrame.LookVector * dashMult

			linearVelocity.Attachment0 = Instance.new("Attachment")
			linearVelocity.Attachment0.Parent = rootPart

			linearVelocity.Enabled = true
			linearVelocity.Parent = rootPart

			for i = 1, 7 do
				applyDashChange(linearVelocity, i)

				task.wait(0.05)

				if i == 7 then
					linearVelocity.Attachment0:Destroy()
					linearVelocity:Destroy()
				end
			end
		end
	end
end)

Aight so for the first one, I’ma put that on the backburner because it’s more efficient for me to spend time on finishing the game than dealing with exploiters that have nothing to play. I’ve come up with a band-aid solution, but I will implement it later so that I can focus on finishing my game.

Although, I still haven’t found out how I will go about doing the second one. I’ve thought of making the client fire a remote event to the server so that it can get tagged. If an explosion hits the dashing player, the tag will be deleted and the server will fire a remote back to the client to cancel the dash.

Issues I’ve found with both solutions tho is that exploiters could simply make their own dash script to circumvent this. I’m at a complete lost on what to do, and have been recommended by another person to simply not worry about making the perfect anti-cheat since it’s a game of cat and mouse.

I may have to rely on myself or other players to moderate the game to prevent cheating. I’ve also thought of a vote kicking system, but that could easily be abused. Maybe a mod-calling system—with false reports revoking access to it. Right now, I’m just praying that this “Server Authority” concept roblox is cooking up makes it near impossible to exploit. :pray:t5:

To answer your questions:

  1. You can have a client-sided anticheat, to check for this dash, to ensure that all properties have been unmodified. This is a basic check, and you could probably do some more sophisticated checks to ensure it’s being kept the same.
  2. You can still destroy the linearvelocity if it detects an explosion on the server, as all server-sided instances are replicated to clients.
1 Like

Exploiters could easily ignore this tho, but I guess just like the first issue they could also. I’ll take that into consideration.

in such cases, you could also manually kill the velocity on the character on the client if you detect the velocity is not destroyed when its supposed to

You should move the script logic to server side, while keeping the UIS to client. Unless for specific reasons, you do not want to do that, you should add a small server-sided script or client side like @lolbiIlyyy said (althought always prefer server because client can be easily deleted unless you manage to make it saved in memory) to check for stuff like walkspeed or assemblyvelocity.