It could be that you are calling the wrong function because Respawn()
is spelled Respwan()
in the code snippet. Try watching https://www.youtube.com/watch?v=tBj-FWcIwYw because it is a good example on how to fix your problem. Another potential bug could be in the actual Unity instpector. Make sure that your buttonClick function is being called when you click the button. You can change this in the Inspector prefs. If you need more help, then maybe try putting more screenshots of your code and your game and also the inspector tab on the UI element.