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

Why is DescendantAdded encountering an error?

Asked by 9 years ago

This script is supposed to detect when a descendant is added to the player (so a Flashlight is picked up in this case) However I get this error: 20:13:54.253 - Players.Player1.PlayerGui.Objectives.Frame.Checker:7: attempt to index global 'decendant' (a nil value)

Anyone know why?

player = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name)
s = script.Parent

player.DescendantAdded:connect(function(descendant)
    if decendant.Name == "Flashlight" then
        for i = 0,1,0.03 do
            s.ObjectiveText.TextTransparency = i
            s.ObjectiveTitle.TextTransparency = i
            s.TextLabel.TextTransparency = i
        end
    end
end)

1 answer

Log in to vote
2
Answered by 9 years ago

You misspelt descendant on line 5 as decendant.

0
Aha thats kinda awkward. Thanks! MasterDaniel 320 — 9y
0
No problem, we all do it sometimes. Spongocardo 1991 — 9y
Ad

Answer this question