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

2D script issue?

Asked by
Bman8765 270 Moderation Voter
10 years ago

This use to work before but now it doesn't seem to work when I put it into this script. Most important part containing the 2D script:

function ClickedCourse1()
    started = true
    print("Started = true")
    Course1.Visible = false
    Course2.Visible = false
    Course3.Visible = false
    CourseSelect.Visible = false
    game.Workspace.CurrentCamera.CameraType = "Custom"
    wait(1)
    game.Workspace.CurrentCamera.CameraType = "Scriptable"
    character:MoveTo(workspace.Course1Tele.Position)
    game:GetService("RunService").RenderStepped:connect(function()
    print("2D mode on")
    camera.CoordinateFrame = CFrame.new(twoD.Position)
                         * CFrame.new(0, 0, 25)
    go = 1
end)
end

The full script:

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
Start.Visible = true
Course1.Visible = false
Course2.Visible = false
Course3.Visible = false
character = game.Players.LocalPlayer.Character
TwoD = game.Players.LocalPlayer.Character.Head
-- Size X 400, Size Y 300
started = false
print("Started = false")
camera.CoordinateFrame = CFrame.new(target.Position)
                       * CFrame.new(20, 5, 20)
                       * CFrame.Angles(0, -.3, 0)

function ClickedStart()
    if started == false then
    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
end

function ClickedCourse1()
    started = true
    print("Started = true")
    Course1.Visible = false
    Course2.Visible = false
    Course3.Visible = false
    CourseSelect.Visible = false
    game.Workspace.CurrentCamera.CameraType = "Custom"
    wait(1)
    game.Workspace.CurrentCamera.CameraType = "Scriptable"
    character:MoveTo(workspace.Course1Tele.Position)
    game:GetService("RunService").RenderStepped:connect(function()
    print("2D mode on")
    camera.CoordinateFrame = CFrame.new(twoD.Position)
                         * CFrame.new(0, 0, 25)
    go = 1
end)
end

Start.MouseButton1Down:connect(ClickedStart) -- Here
Course1.MouseButton1Down:connect(ClickedCourse1)

I'm terrible at scripting currently so it could just be a typo but if you see anything wrong and why it's not working please tell me. Everything else works just fine but when you press the Course1 textbutton it teleports you but doesn't turn into the 2D mode coded in the first code.

Answer this question