that actually work, when i reduce the speed to 20 or 50 it works fine but if i go above that the same problem will happen again. but i need it to go a least 100 speed or it’s too slow
Mkay, so we identified our issue, now we are looking for the solution.
My only thoughts are making a delay between the Touched event firing and setting the Velocity to 0, using a wait
. But, this seems like it’s unreliable and inaccurate.
I’m going to do some research on it, and let you know what I find.
Another possible solution is making the hitbox a bit smaller, so that it’s from the end of the handle to the start of the blade. But don’t make it go through the blade. Let me know how that works.
nope, it still the same as before
This solution is a little clunky, but what you could try is making it so that if hit.Name == part then return. The only problem is you’d have to make sure nothing it could collide with is named part. I don’t recommend this as a long-term solution but it might work for now.
Or maybe try turning canTouch off for every part of the knife except the main hitbox.
nope, did not work. is there any method that is similar to Touched
You could use the GetTouchingParts function, but that would require using a loop.
I don’t see anything wrong however try doing this to avoid memory leak :
local Conn
Conn=new_kunai.PrimaryPart.Touched:Connect(function(hit)
if not hit:IsDescendantOf(character) then
print(hit)
body_velocity.Velocity = Vector3.new(0,0,0)
new_kunai.PrimaryPart.Anchored = true
Conn:Disconnect()
end
end)
Also you could try changing the Hit detection to raycasting or GetTouchingParts.
both kunai position are difference
Oh well thats a replication issue , I would suggest to set the network owner of the Kunai as the Client , handle the physics in client and detect the hit in client . Once it hits a character fire a remote event to the server and do some sanity checks to prevent exploiting, and in the client stop the movement.
Put this on the next line. This could potentially fix the replication issue.
wait()
new_kunai:SetPrimaryPartCFrame(new_kunai:GetPrimaryPartCFrame())
from my experience of making an arrow i found that my arrow was hitting the player which resulted in it being in air so i guess it might be the same problem with you where its hitting the character and stops
well nope, it didnt work
i have also tried using network ownership but…
now the kunai go threw to wall and stop a bit too late
You should handle the physics on the client side and use remotes to notify the server, which will notify the other clients to simulate the kunai throwing. You could also simulate it on the server for collision detection by parenting a dummy kunai to workspace.CurrentCamera which will keep it from replicating.
can you give me an example of the script? like what should I notify the server to do
Don’t use .Touched, it sucks.
Instead, use :GetTouchingParts() every frame. [If it is CanCollide off click here]
A better probable solution is to raycast and set the position of the object to the first hit object it faces at. However, you’ll have to remember that the object may phase through the wall if touched too late.
i figure it out once the touched event is fire just anchored the hitbox and set its position to the position it need to stop