1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

GetPrintName Error after death

Discussion in 'DarkRP Modding Questions & Help' started by Triptox, Jul 8, 2019.

  1. Triptox

    Triptox New Member

    My Code: https://pastebin.com/AvXqyyaM

    My Error:
    .lua:236: attempt to call method 'GetPrintName' (a nil value)

    When i die, the error shows up, when i respawn it goes away. I know the reason but i dont know how to fix it xD pls help thx
  2. FireWolf

    FireWolf Member

    Add a condition in the if statement to check if localplayer is alive.
  3. Triptox

    Triptox New Member

    i already have it
  4. FireWolf

    FireWolf Member

    No you don't? You have this in the if statement: "LocalPlayer():GetActiveWeapon()". All this returns is true. There's nothing checking if the player is alive or not, which seems to be the problem because that's where you're getting the error from.

    An even better method would be by using LocalPlayer():GetActiveWeapon():IsValid(), as LocalPlayer():GetActiveWeapon() will always return true, even when it's nil, whilst IsValid() will return true when it's not nil and a SWEP.
  5. Triptox

    Triptox New Member

    i have it above it bro, if u want contact me on Discord: Triptox#1902 and i will show you the complete script.
  6. FireWolf

    FireWolf Member

    Just add IsValid(), i.e. LocalPlayer():GetActiveWeapon():IsValid().

Share This Page