Okay so I have been working on this code all day but for some reason the teleport script wont work, everything else works fine but when a click on the button and trigger the function it does not teleport me it just closes all the gui's (Which is should do but still it should also teleport).
the main script:
local character = game.Players.LocalPlayer.Character
Start = script.Parent.StartButton
CourseSelect = script.Parent.CourseSelect
target = game.Workspace.Cam
camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
angle = 0
go = 0
CourseSelect.Visible = false
Num = 0
Course1 = script.Parent.CourseSelect.Course1
Course2 = script.Parent.CourseSelect.Course2
Course3 = script.Parent.CourseSelect.Course3
Course1.Visible = false
Course2.Visible = false
Course3.Visible = false
-- Size X 400, Size Y 300
print("Started = false")
function ClickedStart()
CourseSelect.Visible = true
Start.Visible = false
for GuiSize = 1, 45 do
if GuiSize <= 45 then
CourseSelect.Size = CourseSelect.Size +UDim2.new(0.01, 0, 0.015, 0)
Num = Num +1
print(Num)
end
wait()
end
Course1.Visible = true
Course2.Visible = true
Course3.Visible = true
end
function ClickedCourse1()
Course1.Visible = false
Course2.Visible = false
Course3.Visible = false
CourseSelect.Visible = false
wait(3)
character.CFrame = CFrame.new(game.Workspace.Course1Tele.Position + Vector3.new(0,3,0))
end
Course1.MouseButton1Down:connect(ClickedCourse1)
Start.MouseButton1Down:connect(ClickedStart)
Like I have said above, everything else works so if you have any suggestions please help. I should also add that this works fine in Solo mode but when I publish it to roblox that is when it wont teleport. Also I don't see anything bad appear in the output console so I'm clueless on whats going on.

1 comment
This is the error I get: attempt to index global 'character' (a nil value)