Alright, I am new to scripting so this is one of my first touched events. Basically, I am trying to get the brick to turn my legs red when I walk over it. Here is the source. For whatever reason, my legs are not turning red, I was wondering how to fix this?
function touched(hit) hit.BrickColor = BrickColor.new("Bright red") end script.Parent.Touched:connect(touched)
Again, I understand it is a basic script but I have recently started, any help would be appreciated.
ROBLOX changed how body colors worked so that you can no longer change body colors by just changing brick color. This is now controlled by an object called, "Body Colors". Basically what's going is the script is checking if part that touched's parent is a player. Then if that is true then it goes ahead and changes the Left Leg and Right Leg color.
Try something like this:
function touched(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent["Body Colors"].LeftLegColor = BrickColor.new('Bright red') hit.Parent["Body Colors"].RightLegColor = BrickColor.new('Bright red') end end script.Parent.Touched:connect(touched)
Hope this helps!