.I have been trying to make a teleport gui but there is a error
This is the script:
local part = script.Parent
local player = game.Players.LocalPlayer
local TP = game.Workspace:WaitForChild("HouseTeleportIn")
part.Touched:connect(function()
wait(0.5)
if player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").Visible == false then
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").Visible = true
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 1
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.9
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.8
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.7
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.6
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.5
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.4
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.3
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.2
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.1
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0
wait(0.1)
player.Character:MoveTo(TP.Position)
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").Visible = true
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.1
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.2
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.3
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.4
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.5
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.6
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.7
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.8
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0.9
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 1
wait(0.1)
player.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").Visible = false
end
end)
The error in the output says Workspace.HouseDoor.OuterPart.Script:7: attempt to index upvalue 'player' (a nil value)
Please fix the entire script and tell me what I did wrong.

3 comments
Ohh my.
Help please?
http://wiki.roblox.com/index.php?title=Loops#For