My program should work fine, but the output says "Workspace.map.teleporter3.teleport.Script:10 attempt to index global 'player' (a nil value) "
touched = false
button = script.Parent
teleportergui = script.teleporterservice1
function onTouch(other)
if other.Parent.Name == "teleporter3" then --this is because it keeps thinking the model it's in is the character...
touched = false
else
player = game.Players:GetPlayerFromCharacter(other.Parent)
local tele2gui = teleportergui:clone()
tele2gui.Parent = player.PlayerGui
wait(5)
tele2gui:Destroy()
touched = true
wait (10)
touched = false
end
end
button.Touched:connect(onTouch)
can anyone tell me where this went wrong? Please, any questions, tell me.

8 comments
Okay, i will try this. somewhat.
It didn't work.
That isn't very much information to go by. What is the output?
I did put the output, that was all the output said, then the typical stack start, same message, stack end.
Infact, it is the exact same output, and please explain what you mean by other.Parent is not a players character?
If you made the change I suggested, that error is impossible.
Im implementing the fix now, if it works, thank you, if it doesn't, thanks for trying.
Thank you, that worked! Now, maybe you can naswer something else for me, in a gui frame, i have a problem where i have a button called ShopButton1 inside a frame, but no matter where i put the variable in any script, it says 'ShopButton1 is not a member of Frame' I usually fix this problem by turning that variable into a global variable in a script that i put all global variables in. But it isn't