New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

Enemy not respawning if they die by falling from map, why?

Asked by
Kami_Yo 67
11 months ago
Edited 11 months ago

Weird thing is this used to work, I think. But I have a basic respawn script that is supposed to call a function in a script that does the real respawn but for some reason it is never called (likely due to script being destroyed before it has time to run?)

local robo = script.Parent.Name
local humanoid = script.Parent:FindFirstChildOfClass("Humanoid")
local ourFunctions = require(game:GetService("ServerScriptService"):FindFirstChild("SavingFunctions"))
local DeathSound = script.Parent:WaitForChild("Head"):FindFirstChild("Died")

    print(robo, "DIED!")
    ourFunctions.RespawnEnemyEvent(robo) -- this does the respawning


    -- unequip tool

    if script.Parent:FindFirstChild("FollowAI")then
        script.Parent:FindFirstChild("FollowAI").Disabled = true

    if script.Parent:FindFirstChild("DamageScript") then
        script.Parent:FindFirstChild("DamageScript").Disabled = true

The print statement is not even running. The respawn works fine when the enemy is killed by the player or another NPC but doesn't when they fall from the map. Does anyone know a work around?

Best workaround may be removing the possibility of the enemy falling off the map or have the script be part of ServerScriptService instead of being the child of the enemy model, or wherever you currently have it placed. alphawolvess 1784 — 11mo

Answer this question