Hello, this is my first topic on the Developer Forums.
So i’m trying to create a health system using int value for a spaceship, so could I get a model by using Explosion.Hit? Or is it not possible and are there other alternatives to a health-system like this that I can try?
Yes, it is very possible to get the model that a part belongs to through explosions. You can just check if the parent of the hit part is a model, then store that model as a variable.
Here’s an example of how to do it:
local explosion = Instance.new("Explosion")
--define the data of your explosion here
explosion.Hit:Connect(function(hit)
local hitModel = nil
if(hit.Parent:IsA("Model")) then
hitModel = hit.Parent
--do stuff with the model
end
end)