I thought local scripts only do things on one client so the other client doesn’t see it. Well I guess it sorta makes sense because lets say you die on the client the other clients see that too, is that how it works?
Alright so um, new issue… I did what you said doing it on the client. It does replicate so atleast that works but um… it’s flinging me instead of the npc…
local bv = Instance.new("BodyVelocity", rig.HumanoidRootPart)
bv.MaxForce = Vector3.one * math.huge
bv.Velocity = char.PrimaryPart.CFrame.LookVector * 200/2
game:GetService("Debris"):AddItem(bv, .1)
Do you know the reason for this?
Oh is it because of this: char.PrimaryPart.CFrame.LookVector
Because ur applying bv to ur own cframe
When u fire the enemy player’s client u have to pass ur own humanoidrootpart as a parameter
Then on clientinvoke youll have a function along the lines of:
OnClientInvoke:Connect(function(senderHRP, force)
local bv = Instance.new("BodyVelocity", rig.HumanoidRootPart)
bv.MaxForce = Vector3.one * math.huge
bv.Velocity = senderHRP.CFrame.LookVector * 200/2
game:GetService("Debris"):AddItem(bv, .1)
end)
Im on mobile so this is basically completely impossible for me to write lol but yeah
When i get home ill write the code just chill for a sec ill comment it up aswell
But the problem is, the sender’s HRP’s lookvector is not gonna be in line with the knockback sent from the player’s lookvector. + I actually tried this by changing it to the rig’s lookvector anyway and it still didn’t work. It still FLINGED ME. ME BRO ME.
Breh i told u ill do it when i get home just give me like 20 mins ill explain how it works too
but i mean the main point was that I was applying it to my own cframe, but that’s obviously not the issue as trying the rig’s lookvector didn’t work either.
I replicated it but its stil basically the same lag
Changing networkownership is probably the solution
Personally i don’t care for my case use so I’m just gonna leave it as it is lol
This is the chillest and best devforum discussion I have ever seen. Everyone is being friendly and helping each other.
I think you should adjust density of the player, that will change the beginning transition from force to be more instant, if that’s a server to client problem then I suggest assigning network ownership to the enemy’s character for a brief period of time at the beginning.
Are you sure, I think i’m dying eternally right now.
but isn’t network ownership even more security vulnerabilities?
Tried lowering the density to like 0.01 and didn’t work, tried putting the friction to 0 too but it still looks the exact same. It was a good idea though, I was thinking in my head that might work.
I even tried this and the NPC is still not being affected by the force, someone literally used the exact same script as meand it somehow worked for them. I might try using a different rig.
I mean, it seemed pretty chill to me, but it looks like I was wrong.
Unless you think you have an answer, then we’ll be chilling.
For anyone interested this is the bug, on the client-side it literally does nothing. My theory is that it applies the force to the rig but it doesn’t do anything to it, it instead does things to players in its region.
Its probably just their ping that makes it look smoother, it happens w me sometimes too
Let me go ask oss lol
can you record it with studio settings → physics → are owners shown enabled
Ok i actually have a sort of viable solution I think.
Situation where youre applying knockback to another player:
U would knock them back on YOUR client which would make it not jittery
U would fire their client and then make themselves get knocked back the same distance
This is pretty dumb i think and other clients will still see jitter but it should be smooth for both players’ clients
I think no, not really. So, you should be fine…