I’m currently working a fireball script. When hitting a target an explosion will happen and a hitbox will be created, damaging the enemy. Everything is working just fine until the fireball is hitting a target. When it does, the hitbox created will have the same position as the fireball, but for some reason it’s going to have a different offset, as you can see in this gif: https://gyazo.com/7cd50e62fe24080bd1399369a9b525b3 .
I tried searching for solutions on both devforum and scriptinghelpers but couldn’t find anything. Welding the hitbox to the fireball won’t work either.
An even better question: You are probably firing a remote event/function to create the hitbox on the server… Are you sending the fireball’s position right when it touches something or did you store the position in a variable before the fireball touches anything?
Any part that isn’t in a folder called “Effects” will be considered a solid part by the script. If I hit a bigger part then it will go straight to the middle of the part hit. I’ll try CFrame.
In the code I sent above, you can see a function called CheckForSolidPart. This is how it works:
function module.CheckForSolidPart(Part, PCharacter)
if Part == nil then return end
if Part.Parent == nil then return end
if Part.Parent == workspace.Effects or Part.Parent.Parent == workspace.Effects or Part.Parent.Parent.Parent == workspace.Effects or Part.Parent == PCharacter or Part.Parent.Parent == PCharacter then
return false
else
return true
end
end
Because at first I was using a model to replicate the explosion that was meant to happen, and then made the actual projectile bigger after I noticed that it happens the same with the cloned explosion model.
function module.CheckForSolidPart(Part, PCharacter)
if Part == nil then return end
if Part.Parent == nil then return end
if Part:IsDescendantOf(workspace.Effects) or Part:IsDescendantOf(PCharacter) then
return false
else
return true
end
end
Also tried using Rotated Region3 Module by EgoMoose to make a Region3 hitbox but it happens the exact same. I think it’s because of roblox’s physics engine?