Excuse the silly commentary, but I'm hoping it'll help you figure out what exactly it is I'm trying to do. I'm working on the same game I was 4 years ago, "Eaten by Cats", and I need a brick to change color when it touches the parent of this script but it refuses. The script doesn't seem to be throwing any errors of any kind, even when I enable debug.
function onTouched(Meat) --Eww, something touched me!! I'm gonna call it "Meat". local oldmesh = Meat:FindFirstChild("Mesh") --Was it something with a Mesh? if oldmesh ~= nil then --WAS IT??? oldmesh:Remove() --EWW IT'S LUMPY REMOVE THE MESH end local Decal = Meat:FindFirstChild("Decal") --Is there a Decal here? if Decal ~= nil then --Just in case there is... Decal:Remove() --KILL IT. local Decal = Meat:FindFirstChild("Decal") --Is there a Decal here? end local Humanoid = Meat.Parent:FindFirstChild("Humanoid") if Humanoid ~= nil then Humanoid.Health = 0 end if Meat.Name ~= "Head" then --AAH, A HEAD!! Meat.Name = "Food2" --I shall throw it away, and feed the rest of the body to my children. end Meat.Material = "Granite" --Granite looks a bit like meat, why not? Meat.Cancollide = true --Arms won't fall through the ground. Meat.BrickColor = Color3.fromRGB(255,148,148) --Medium rare mutton color. end script.Parent.Touched:connect(onTouched) --This tells onTouched() to happen when it's touched. --Script by SethPaw
On line 20, its CanCollide
, not Cancollide
!