so what I want to achieve is using an explosion. hit function which allows explosions Detect parts in their range which allows for an easy way to damage a separatist ship’s health that’s why the health stuff is for but it’s not detecting anything and I’ll show a video if needed
debounce = false
print(“explosion is runing”)
script.Parent.Hit:Connect(function(part)
if part.Parent.Name == "seperatistbattleship" then
local healthbar = part.Healthpart.Healthbar
local healthvalue = part.Healthvalue
print("working sepbattleship")
if healthvalue.Value <= 0.70 then
healthbar.Frame.Full.BackgroundColor3 = Color3.new(0,200/255,0)
healthvalue.Value = healthvalue.Value - 0.1
healthbar.Frame.Full.Size = UDim2.new(healthvalue.Value)
elseif healthvalue.Value <= 0.40 then
healthbar.Frame.Full.BackgroundColor3 = Color3.new(200/255,200/255,0)
healthvalue.Value = healthvalue.Value - 0.1
healthbar.Frame.Full.Size = UDim2.new(healthvalue.Value)
elseif healthvalue.Value <= 0.1 then
healthbar.Frame.Full.BackgroundColor3 = Color3.new(200/255,0,0)
healthvalue.Value = healthvalue.Value - 0.1
healthbar.Frame.Full.Size = UDim2.new(healthvalue.Value)
elseif healthvalue.Value == 0 then
part.Script:Destroy()
end
end
end
end)
print(“ive vbeen destroyed”)