#why this script dosnt work :(

1 messages · Page 1 of 1 (latest)

pulsar hull
#

so this was supose to be a script wher if the parent totches a part named "somthing" but it dosnt work. :(
local parentPart = script.Parent
local damageAmount = 25
local targetPartName = "somthing"

parentPart.Touched:Connect(function(hit)
if hit.Name == targetPartName then
local current = hit
while current.Parent do
local config = current:FindFirstChild("Config")
if config and config:FindFirstChild("Health") then
local health = config:FindFirstChild("Health")
if health:IsA("NumberValue") then
health.Value -= damageAmount
print("Damaged:", health:GetFullName(), "→", health.Value)
break
end
end
current = current.Parent
end
end
end)

earnest nicheBOT
#

studio** You are now Level 1! **studio

delicate tangle
#

@pulsar hull

delicate tangle
#

it seems pretty redundant to use one

#

And it might not be working because parts with the name of "somthing" might be anchored. .Touched events only work with unanchored parts

thorn gull