I don't know where to start to make my fireball that shoots out when I click a key disappear if it hits a wall. I made it disappear when it hits a person but idk where to start if it hits a part
How to make my fireball disappear if it hits a wall?
1 answer
Hey!
BasePart's have a .Touched event you can use to see when it touches anything. To make it disappear, you can destroy your fireball if the event is ever fired. An example is shown below...
fireball.Touched:Connect (function(t) -- t = The part that just touched your part
fireball:Destroy()
end)
That is pretty much the extent to how .Touched works! As you can see, it also passes a parameter, this parameter being whatever part had just started touching your fireball and caused the event to fire. You can use this to specify what parts you want to ignore from destroying your fireball. In the example below, I inserted an if statement making your fireball ignore any parts named "IgnorePart" from allowing the fireball to get destroyed.
fireball.Touched:Connect (function(t)
if t.Name == "IgnorePart" then
t:Destroy()
end
end)
Hope this helped! If it did, please remember to mark this answer.
This discussion is preserved as it was. New answers, comments, and votes are closed.
