I need to make this script so that if a part touches the expanding red ball, it will 'liquify'. I put in a print command, but it only fires if it comes in contact with a player. Here's the code.
script.Parent.Touched:Connect(function(hit)
print("Liquify touch")
if not hit:IsDescendantOf(workspace.ReactorCore) then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
local flame = Instance.new("Fire", hit.Parent.HumanoidRootPart)
flame.Color = script.Parent.Color
wait(1)
for _,v in pairs(hit.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.BrickColor = BrickColor.new("Really red")
v.Material = Enum.Material.Neon
end
end
wait(1)
local explosion = Instance.new("Explosion", workspace)
explosion.Position = hit.Parent.HumanoidRootPart.Position
humanoid.Health = 0
elseif humanoid == nil then
print("Melting")
hit.BrickColor = script.Parent.BrickColor
hit.Material = Enum.Material.Neon
wait(2)
hit.Anchored = false
end
end
end)
If anyone can tell me why it isn't working, I'd be very grateful.
- JB_SuperGamer
UPDATE: I have discovered that it will only melt unanchored parts. Does anyone know the cause of this?

3 comments
The code should work as expected. Granted you never check if the hit was indeed the red ball. The red ball is not a descendant of ReactorCore, right?
is this a localscript or normal script? since touched doesnt work on localscripts
No, the script is just a normal script, and no, the red ball is a descendant of ReactorCore