this Script detects when the humanoid touches it so that it will turn Lime green and when the humanoid is not touching it it turns white, but it just stays green, why is that?
local part = script.Parent
part.BrickColor = BrickColor.new("Institutional white")
local function handleTouch(otherpart)
local character = otherpart.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
part.BrickColor = BrickColor.new("Lime green")
if not humanoid then
part.BrickColor = BrickColor.new("Institutional white")
end
end
end
part.Touched:connect(handleTouch)
AND THERE IS NO ERRORS

2 comments
this did not work, the part still stayed green :/
Updated my post slightly. What does printing out humanoid output in console?