# In ROBLOX, how can I check what is in front of me?

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

• Hello, I just removed the greeting, signature, etc. from your post; those are not necessary (your name is on the post already, and we know you're here asking for help), and they actually detract from the important part of the post, which is the question. You can further edit your post or revise my edit. – Seth Battin Aug 5 '15 at 13:45
• And while you're editing, you should include much more detail. You linked to the general page of the engine you are using, but you didn't include any of your code whatsoever except for a couple of variable names. So there is no way anyone can help you unless you include at least some way to look at your current work. – Seth Battin Aug 5 '15 at 13:47