Help with spell collision

Well, I’m trying to get the red object to be thrown forward until it touches the green object, when that happens, the red object must stop moving immediately.

The red object is taking too long to stop moving, and I need the object to stop before crossing, because I’m trying to create a spell collision with it.



local FX = workspace:WaitForChild("FX")

local rStorage = game:GetService("ReplicatedStorage")
local rEvent = rStorage.Events:WaitForChild("Projectile")

	local char = workspace:WaitForChild(plr.Name)
	local hum = char:WaitForChild("HumanoidRootPart")
	local x ="Part", FX)
	x.Name = "Projectile"
	x.Anchored = false
	x.CanCollide = false
	x.BrickColor ="Really red")
	x.Material = "Neon"
	x.Shape = "Ball"
	x.Size =,3,3)
	x.CFrame = hum.CFrame *,0,-3)
	game.Debris:AddItem(x, 15)
	local bv ="BodyVelocity", x)
	bv.MaxForce =, math.huge, math.huge)
	bv.Velocity = hum.CFrame.lookVector * 100
		if hit.Name == "Barrier" then
			bv.Velocity =

Thank you for your attention!

Do you mean WaitForChild:(plr.Character)?

1 Like

Both work. The script is not giving an error, it is just not having the expected result…

What are you exactly trying to get in result?

I would like the projectile to stop moving as soon as it touches the barrier, but at the moment it’s moving a little bit from the position it should stop

Is the spell moving fast? The physics updates at 60 fps, It might be going so fast that it goes through the block or the update happened and the spell is inside the block

Try using raycast. You can make it so that collision occurs when raycast’s length goes under a certain threshold, e.g 0.1 studs.

1 Like

Never use Touched for this type of things, you can use Ray Cast.

Try setting the networkownership of the parts to ‘nil’, this sets it automatically to the server. I hope this helps your problem.

Maybe I’m a little late but use RunService.HeartBeat in order to

  1. move the projectile
  2. send several raycasts to detect if the projectile hit something.

Neither body velocities and tween service are efficient for making projectiles.