Can someone please explain this in an easy way to understand?
function onDamage(Part) if Part:findFirstChild("Humanoid") == nil and Part:findFirstChild("BodyVelocity") ~= nil then Part.Anchored = true if Part:findFirstChild("Mesh") ~= nil then z = Part:findFirstChild("Mesh") for i = 1,5 do z.Scale = z.Scale + Vector3.new(1,1,1) wait(0.05)
It expands the head, if there's a BodyVelocity inside of it.
1 function onDamage(Part) 2 if Part:findFirstChild("Humanoid") == nil and Part:findFirstChild("BodyVelocity") ~= nil then 3 Part.Anchored = true 4 if Part:findFirstChild("Mesh") ~= nil then 5 z = Part:findFirstChild("Mesh") 6 for i = 1,5 do 7 z.Scale = z.Scale + Vector3.new(1,1,1) 8 wait(0.05)
Line 1: Function, named onDamage.
Line 2: If the Part (the part that is touched) does not have a child named "Humanoid" inside of it and there's a BodyVelocity inside of it, then...
Line 3: Anchor the part, prevent it from moving
Line 4: If there's a Mesh inside of the Part (or a an object named part) then...
Line 5: Makes a new variable called "z", a shortcut to the mesh inside the part.
Line 6: "for i = 1, 5 do" tells us that the code is going to be repeated 5 times.
Line 7: (This is going to be repeated 5 times) the mesh's size is going to become 2x larger
Line 8: "wait()" means that the repeat is going to be put on hold for the time in the brackets. You can think of it as a "pause" before the next code is executed (in this case, another repeat, via the "for" loop).
Satisfied?