Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is DescendantAdded encountering an error?

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

✓ Accepted answer

You misspelt descendant on line 5 as decendant.

2 comments

0

Aha thats kinda awkward. Thanks!

0

No problem, we all do it sometimes.

This discussion is preserved as it was. New answers, comments, and votes are closed.