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

Why is it saying "Cannot index local 'Player'" in my teleporter script?

I have a teleportation service running in my game where players can be teleported to diffewrant rooms, but the output is saying: Workspace.map.teleporter3.teleport.Script:8 attempt to index local 'Player' (A nil Value) theres no point in putting the rest, because it basically repeats te directory, and it is the same for all three, so i am only putting one. Here is the code:

button = script.Parent
teleportergui = script.teleporterservice1
function onTouch(other)
player = game.Players:GetPlayerFromCharacter(other.Parent)
	local tele2gui = teleportergui:clone()
	tele2gui.Parent = player.PlayerGui
	wait(5)
	tele2gui:Destroy()
end

button.Touched:connect(onTouch)

it is supposed to put in a GUI into the player, that you use to choose where to go, but you already know what the output says, so can anyone please help me?

3 comments

0

You should probably implement debounce into your code a long with checking if other.Parent is actually a character's player mode.

0

Do you have a place where to learn how to use debounce?

0

It is actually giving an error code now, saying it cannot index global player.

1 answer

One question: Did you put full code? The code you've put in the script is all correct... If you didnt put please tell US full code and i will be able to help. PLEASE DONT DISLIKE BECAUSE ITS TRUE I NEED FULL CODE

2 comments

0

That is the full code

0

For putting the gui in the player.

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