There are many ways to make anti-cheat.
Also, the client script can’t really be hacked unless you’re using remote events. It’s not like they can jump into the code and change the lines.
I tried this, and it seems mostly functional! However, even though the brick is anchored, when you die, it starts flying into the void and disappears. Any thoughts?
Check if the players dead and stop pathfinding if so.
my guess is you died and its chasing your humanoidrootpart (which is probably falling into the void)
I was planning on using remote events to update brick’s position on the serverside because the game is multiplayer. Exploiters could manipulate it there
Fair, I was just giving you a quick break-down on why this issue was present lol, best of luck to your game
if distance <= closestDistance and distance and v.Character:FindFirstChildOfClass("Humanoid") and v.Character:FindFirstChildOfClass("Humanoid").Health > 0 then -- if the distance of the player is smaller than the previous closest distance, then run the code below
(making sure dead players arent checked)
I’ve tried this, but for some reason it’s defunctional. I don’t exactly know why, either.
It is working as expected now. Thank you very much for your help, the brick now kills you if you are running in a straight line! You deserve a gold star for your efforts!
if it isnt taking dead players as new variables, the issue is probably in the following script; in which you can do
for z,waypoint in pairs(path:GetWaypoints()) do -- get all of the waypoints
if closestPlayer.Parent:FindFirstChildOfClass("Humanoid").Health <= 0 then return end
local newerPos = waypoint.Position
local bestTween = ts:Create(script.Parent, info, {Position = newerPos})
bestTween:Play()
task.wait(math.clamp(brickSpeed, 0.05, 2)/closestDistance)
edit; nvm
Sorry, I accidentally put the if statement in the wrong place which is why it was causing the issue. I corrected it, and it works as expected now.
Its already been solved Bro
The brick has no humanoid. I recommend reading through the replies first before posting.