NPC doesn't know when Player Respawns

Where is this script being placed? are there any console errors?

1 Like

its in serverScriptService the only thing i get for an error is this
Screenshot 2023-12-06 164112

1 Like

instead of player added how about character added

1 Like

can you expand on that? because there is a character.added in there

1 Like

How about a time out on the waitforchild?
local PlrHumRoot = Char:WaitForChild(“HumanoidRootPart”,30)

if you want another way to get around this maybe the waitforchild error is there because the character is a nil

tell me your results

1 Like

no results there. the error is in the automated animate script for the player i dont know if that helps at all

1 Like

What type of Character is this? R6 or R15

1 Like

its a R6 character that i made. the infinite yield seems to start when the player starts moving

1 Like

The issue is that your character is R15, R15 characters don’t contain Torso, only UpperTorso and LowerTorso. You should probably do this, to make it so it is playable for R6 and R15. I am not sure where you get the Torso but this will work:

FindFirstChild:("UpperTorso") or FindFirstChild("Torso")
1 Like

no idea how that would be though since i made rigged it as R6 because its a custom character for the game or is scripting animations different between R6 and R15? the script is the automated one its not my script so i dont think i can edit that

1 Like
1 Like

im not doing a patrol system… the enemy stays in place. im sorry but did you view the video? i dont understand what you are trying to show me here

1 Like

this is a pathfinding script that follows the player and doesnt lose it after resetting

1 Like

im not pathfinding though. the NPC just looks at the player with cframe and then attacks when the player is close enough, it doesnt move so there is no pathfinding in the script.

1 Like

i noticed i had an extra part so i change to R15, and renamed the parts now theres no errors but the issue still remains

1 Like

ok so an update, i tested the game and printed the distance between the enemy and player after the player dies and the enemy still thinks the plr root part is in front of it. now i understand the problem but still not sure how to go about it

1 Like

i took out the debounce = false in the atk function now the attack doesnt repeat. i think it is stuck somewhere in the cframe loop

1 Like

its not detecting either the player or the player character.

1 Like

it didnt detect anyone so thats why i had to redo my get player function

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.