Script doesnt work, but theres no error 6

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    A “Physics” script that makes parts fly outward from a “Bullet” and despawn after 10 seconds.
  2. What is the issue? Include screenshots / videos if possible!
    It just doesnt work, no error output.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Changing values, yes.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
script.Parent.Touched:Connect(function(hit)
	if hit.Name=="Bullet" then
		local c=CFrame.lookAt(hit.Position,script.Parent.Position).LookVector
		local n=Instance.new("BodyForce")
		n.Force=c*-200
		n.Parent=script.Parent
		script.Parent.Anchored=false
		task.wait(10)
		script.Parent:Destroy()
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Is that a local script or a server script?
Are the parts created locally or on the server?
If you add statements throughout, which parts of the code activate

Server script, the Parts are part of the map, everything.

Does the object move at all? Does it get deleted after 10 seconds?

so all lines of code are reached?

Projectiles should not be used with .Touched events as they work half of the time, for projectiles and hotboxes at least, Also one of the parts have to be unanchored for it to register.

But I would use something else for hit detection like ray casting, because as stated before. Touched is very unreliable.

1 Like

It doesnt move, even when the BodyForce is inserted. Yes.

Try using ApplyImpulse instead of BodyForce if you are going for throws

Thank you for this suggestion, it worked!