Touch event not working because of the RunService

I was scripting a fireball that follows your mouse. However there is one bug that I don’t know how to fix. Touched is just not working
Video(you can look at the output right here)


Code

P.S: GetMouse is a remote function that returns Player’s Mouse.Hit

This event only fires as a result of physical movement, so it will not fire if the CFrame property was changed such that the part overlaps another part. This also means that at least one of the parts involved must not be Anchored at the time of the collision.

The Touched event is fired when a player or other part touchs the referenced part. It is not fired by the mouse.

Oh? So how to check if it touched smth then?

Is the fireball anchored? Because the touched event will only fire if it’s physics-updated. Else use a heartbeat and Fire:GetTouchingParts(), this method will return a table of all the other parts (with CanCollide) that are touching the fireball.

You can easily check if it touched other player, because player not anchored

Yes it is anchored. But still, how to check if it touched something then?

So you have two options, either unanchor the fireball and figure out how to make it so it doesn’t fall. Or to use the heartbeat and GetTouchingParts() method

  1. I made a non anchored part and the fireball still doesn’t work. So yeah, means fireball must be unanchroed
  2. I need it to stop when it touched anything, not just other players

Making it so an unanchored part doesn’t fall can be made by putting a LinearVelocity on it

thank, you I will try both methods

I did try it with linear velocity before but it is kinda laggy

There are properties that you have to change so it works correctly:

Attachment0: Some attachment that’s in the center of the part
MaxForce: Something big, very big

But anyway the touching parts method worked, that you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.