So it works perfectly except for one thing, when my player has a box collider on it keeps on hitting his own collider which isnt what i want. Is there 2d rays to ignore certain tags or a way to not hit your own collider?
The documentation says how to do what you need to do. It explains that there is a layer mask parameter you can use in it, so it will only hit rays on colliders that are in that layer, such as a “Ground” layer.
var hit : RaycastHit2D=Physics2D.Raycast(transform.position, dir,1.0, 1 << LayerMask.NameToLayer("Ground"));