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

Attempt to index number with death?

So I'm making a gui that depending on the player's cause of death they get shown a different message when they go back to the lobby, but whenever they get teleported back they get an error saying "attempt to index number with death", here is the piece of code that's causing problems:

local teleportData = tps:GetLocalPlayerTeleportData()
if teleportData then
	
	print(teleportData.death)
	
	local r = teleportData.death
	print(r)



	local v = textTable[r]

	local plr = game.Players.LocalPlayer

Whenever I teleport the player, I am sending a number, but somehow the script doesn't want to receive a number. Also it fully works whenever I put a normal number manually, help?

(the error is on line 6)

1 answer

ANSWER:

I fixed this by simply indexing the teleportData directly, I misinterpreted the guides on the dev api website: since I didn't teleport a dictionary, there was no "death" to refer to.

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