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

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

Asked by 10 years ago

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?

0
You should probably implement debounce into your code a long with checking if other.Parent is actually a character's player mode. Sparker22 190 — 10y
0
Do you have a place where to learn how to use debounce? rollercoaster57 65 — 10y
0
It is actually giving an error code now, saying it cannot index global player. rollercoaster57 65 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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

0
That is the full code rollercoaster57 65 — 10y
0
For putting the gui in the player. rollercoaster57 65 — 10y
Ad

Answer this question