In ROBLOX Studio I need to check what part is in front of the model Freddy
.
I need to set the variable called thingInFront
to the part that is in front of the model Freddy
so that I can decide whether I should allow him to walk through or not. This is my current code:
thingInFront = nil
if thingInFront.BrickColor == BrickColor.new('Black') then
script.Parent.Parent.CanCollide = true
else
if not thingInFront.BrickColor == BrickColor.new('Black') then
script.Parent.Parent.CanCollide = false
end
end