It’s default, I’ll try box real quick.
Box provides the same results as default.
Alright you might not want to do this but can you give me the model itself because it may be easier to fix. Though I understand if you don’t want to give the model away to a stranger lol
Your issue is most likely that tweening is not a physics based movement, thus not registering any “contact” able to ignite the Touched event. Looking at Topics of similar nature, many people suggested a) making a hitbox and attaching it to the knife, and b) using BodyMovers. The following topics provide the workarounds to this that I believe you could benefit from:
- Tweening breaks the touched event - Help and Feedback / Scripting Support - DevForum | Roblox
- Part Touched event not triggered while tweening - Help and Feedback / Scripting Support - DevForum | Roblox
Additionally, remember the Touched event will not occur if both interacting parts are anchored.
You could possibly raycast or region3 each heartbeat frame of the knife? Because it doesn’t require physics.
Hitbox isn’t work for me, and using BodyMovers makes the anchoring weird. Is there a way to fix the glitching with BodyMovers?
Video example:
https://gyazo.com/7a6d65db513f3a339c17b07b440d2355
How would I accomplish that? I’m not too familiar with region3 or heartbeat.
I meant you could use runservice.Heartbeat and each heartbeat frame you could create a region around the knife which acts as a hitbox. Region3 can be used even if the part is anchored. Region3 is basically a box made of 2 vectors. I think region3 is better than touched event as region3 can detect multiple parts in one region.
Would that affect performance? (I’m still unsure what to do, could you give me a part of code as an example or something?)
You could actually just do a raycast in the direction you throw the knife and then if the raycast touches a part, you could use that part to do something when the tween ends.
So I would make a raycast to kill things?
Basically yes.
The raycast should be able to detect a character part.
So the knife would just become decor?
You could directly use a Script in a tool without remoteevents and body velocity to move the knife.
Create a script for the knife’s damage and rename it “DamageScript” and put it in ServerStorage
You could do this:
script.Parent.Activated:Connect(function()
local handle = --variable of the tool's handle
local knife = --make the variable of the knife and :Clone()
knife.Parent = workspace
local bv = Instance.new("BodyVelocity")
bv.Parent = --a part of the cloned knife
bv.Velocity = handle.CFrame.lookVector * velocity you want
local damageScript = game.ServerStorage:FindFirstChild("DamageScript"):Clone()
damageScript.Parent = --part of the cloned knife
end)
For the damage script you could do this:
script.Parent.Touched:Connect(function(hit)
local char = hit.Parent or hit.Parent.Parent
if char:FindFirstChild("Humanoid") then
char:FindFirstChild("Humanoid"):TakeDamage(100)
end
end)
No, the knife is needed because the player wouldn’t know that it is throwing a knife instead of using a gun or kill another player without touching it with something.
This will not work because this can only make the knife go horizontally meaning if the player would want to throw the knife on the ground, it wouldn’t be able to.
Also the knife won’t be able to stop because the velocity doesn’t get reset.
Wrong. If you see I used .lookVector so it will move it in the position + the orientation of the tool’s handle.
To stop the knife he can just delete it after the knife hits something…
I understand that my statement was incorrect but my other one is still correct. You can’t make the knife go in any direction because he doesn’t have a script that makes his arm go up and down without jumping.
Sincerely i didn’t read everything so i wasn’t aware of the arm’s movement in that case he could need tweenservice and raycast but he can just make a simple script which allows the player to move the arm.
He already has a script so this can be considered as unnecessary work.