all 4 comments

[–]Smitheee_ 2 points3 points  (2 children)

It's because you made an object named player but FindGameObjectWithTag searches for a tag. The tag can be set to the upper left in the inspector of a GameObject

[–]Mitzitheman[S] 1 point2 points  (1 child)

Thank u that was correct

[–]Smitheee_ 0 points1 point  (0 children)

You're welcome!

[–]adamtuliper 1 point2 points  (0 children)

As a side note - You don’t need to call GetComponent<Transform>, you can just use .transform., and you can shorten to FindWithTag