i want to get a script from the object thats being hit with a raycast but var ob :script = hit.gameObject.GetComponent(script); isnt working
Use hit.transform.gameObject.GetComponent(script) instead. If I’m not mistaken RaycastHit doesn’t store a reference to the gameobject itself, only to the transform.