roblox lua scripts

-- Step 1: Create a function named "onTouch"
local function onTouch(hit)
  -- Step 2: Check if the object that was touched has a Humanoid parent
  local humanoid = hit.Parent and hit.Parent:FindFirstChild("Humanoid")

  -- Step 3: If a Humanoid is found, print a message
  if humanoid then
    print("Humanoid touched!")

    -- Step 4: Change the color of the part that was touched to red
    hit.BrickColor ="Bright red")

-- Step 5: Get the part to be monitored for touches
local part = script.Parent

-- Step 6: Connect the onTouch function to the Touched event of the part