I’m sort of new to scripting so I don’t know how to secure everything properly and yes the humanoid is taking damage
I’m not talking about the player argument. It can’t be exploited. I’m talking about all the other parameters. An exploiter can send a “humanoid”, “damage”, and “humrootpart” of their choice if they wanted to as there’s no protection, on both client and server.
I know, I was talking about errors, if an exploiter fires the remote event without a character the server will be flooded with errors, I know this can be caused from other lines in that script too, but I was trying to keep my part error-free.
Yes I know that. I’m talking about the RemoteEvent parameters, what you’ve done there for the character check is fine. I think we were misunderstanding each others lol.
@offizen Could you try changing the script to this again, I think I might’ve fixed it, also tell me what does it print in output.
Try doing:
local KnockBack = Instance.new("BodyVelocity");
KnockBack.MaxForce = Vector3.new(300000,300000,300000); -- (I'd keep this low, there's no need to use math.huge. It would just make the knockback jittery)
KnockBack.Velocity = (humrootpart.Position - player.Character.HumanoidRootPart.Position).Unit * Speed;
KnockBack.Parent = humrootpart;
Sorry, I had a class so I couldn’t respond but it still just launches them in the direction the other player is facing
Nothing is printing in the output
Could you try using this for debugging?
local KnockBack = Instance.new("BodyVelocity", humrootpart)
KnockBack.MaxForce = Vector3.new(TotalForce,TotalForce,TotalForce)
local Direction = (humrootpart.Position - player.Character.HumanoidRootPart.Position).Unit
KnockBack.Velocity = Direction * Speed
print("Knockback direction ", Direction)
It should print something in the output
Oh yeah true, I know why. Do this:
KnockBack.Velocity = (humrootpart.Position - player.Character.HumanoidRootPart.Position).Unit * -Speed
(Speed is negative now, this should fix it)
Did you try turning off colliding of all player parts?
It still hasn’t worked unfortunately
I used your code and it says
Knockback direction NAN, NAN, NAN
though I am using it on a dummy so maybe that’s why
Sorry but how would I do that?
Oh I understand the problem, you were giving the humrootpart
of the attacker, not the victim, in your client code make it so it uses the victim’s HumanoidRootPart instead of the attacker’s at the line punchEvent:FireServer(humanoid, damage, humrootpart)
Sorry but how would I be able to fix it on the server script after?
The server script is fine, just change these in the local script.
Well,
for _,v in pairs (Character:GetChildren()) do
if v:IsA("Part") then
v.CanCollide = false
end
end
Basically, it will turn any possible part Collide to false. As I remember it shouldn’t change Torso and HumanoidRootPart.
I don’t clearly remember which, but in toolbox there was a blackhole model. Just open a new place, find it there, then put this asset in this place (there must be script which pulls player using BodyMover, basically, it’s same what you are trying to do, but instead of knocking back it pulls)
EDIT: Found it. You can delete all parts except Singularity and leave only Script in it (without attract)
everyone in this thread is doing too much just play with the velocity value a little bit and youre issue will be fixed
I’ve re-written the code and made it all server-sided so now everything works like I want it to. Thanks to everyone for helping