HumanoidRootPart is an invisible part inside your character that is located around the torso. the local parts = HumanoidRootParts:GetTouchingParts() will return an array with parts that collided with your character. An array is a class that can hold many values, here is an example:
local examplearray = {value1,value2,value3,ā¦}
If you use # before the name of an array you set, you get the number of elements on that array. In this case, the number of parts collided. Also, you can find a specific value by using its number. For example:
examplearray = {value1,value2,value3}
āif you type examplearray[1] it will return value1, if you type examplearray[2] it returns value2, and so on.
With this in mind, I can make an iteration of all parts that touched the player, applying the same type of code to every one of them:
for i=1,#parts do
The line of code mentioned starts an iteration that will be repeated by the same amount of parts found by GetTouchingParts(), and the āiā value will be different on each iteration, starting from 1 until it reaches #parts. You donāt need to name it āiā specifically, but I usually call it that.
if parts[i].Name == āHeatā and parts[i].Parent.Name == āCampfireā then
On the previous line the āiā in parts[i] will make so in every iteration a different āpartsā value will be called, starting from parts[1], then parts[2], until it reaches parts[#parts], the last value. This will let you apply the same code you want to all of the values, which is in this case to check if they are named āHeatā and if its parentās name is āCampfireā
āput heat effect code here
endāto end the if condition
end-- to end the āfor iā iteration