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

CharacterAdded is not a valid member of RBXScriptSignal?

ive been looking for answers for this error ive tried: player.Character:wait(), player.CharacterAdded:wait()

full script:

player = game.Players.PlayerAdded
char = player.CharacterAdded	
Humanoid = char:WaitForChild('Humanoid')

script.Parent.Equipped:connect(function()
	local stance = Humanoid:LoadAnimation(script.Parent.Stance)
end)

the error 'Character is not a valid member of RBXScriptSignal' is on line 2: char = player.CharacterAdded

im tired this is probably a dumb mistake

-thanks

5 comments

0

You're really indexing game.Players.PlayerAdded.CharacterAdded with your first two lines. Try actually connecting to these events?

0

nope same error

1

Try "game.Players.PlayerAdded:wait()" and "player.CharacterAdded:wait()"

0

Also, use local variables instead of global ones. Simply put "local" in front of your "player", "char", and "Humanoid" variables.

0

what is the difference?

1 answer

✓ Accepted answer

Do this instead:

game.Players.PlayerAdded:connect(function(player) --name "player" to whatever you want
	player.CharacterAdded:connect(function(char) --name "char" to whatever you want
		local humanoid = char:WaitForChild("Humanoid")
		script.Parent.Equipped:connect(function()
			local stance = humanoid:LoadAnimation(script.Parent.Stance)
		end)
	end)
end)

If you wanted to define player at the beginning like blah = blah, then put it in a local script and define player as localplayer. But this way is easier. Accept if this worked for you!

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