Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

AncestryChanged not firing when moved to lighting?

Asked by 8 years ago

So I've got a backup script that tracks to players. The model Meaners, or the Player capturer, and the model capturee, or the Player player.

there are two descendants of this script. One, being named Player, is an object value that points to a Player that has been moved to Lighting. The other, Capturerer, is a String value of the player who activated a weapon on the Player.

Both Player and Capturer are alredy filled with their proper values.

Yet, when Meaners is moved to lighting, no event fires.

wait()


local Meaners = game.Workspace:FindFirstChild(script.Capturerer.Value)
local capturer = game.Players:GetPlayerFromCharacter(Meaners)
local capturee = script.Player.Value
local player = game.Players:GetPlayerFromCharacter(capturee)


function LetGo()
    print("Let GO ran")
    player:LoadCharacter()
end


function Moved()
    script:Destroy()
end

function PlayerLeft(Person)
    if Person == capturer then
        player:LoadCharacter()
    end
end


Meaners.Humanoid.Died:connect(LetGo)
game.Players.PlayerRemoving:connect(PlayerLeft)
Meaners.AncestryChanged:connect(LetGo)
capturee.AncestryChanged:connect(Moved)

Why is this and how do I fix it?

Answer this question