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

Why is the camera stuck?

Asked by 10 years ago
sp = script.Parent

script.Parent.MouseEnter:connect(function()
    sp.Image = "http://www.roblox.com/asset/?id=154945404"
    sp.Size = UDim2.new(0.4,0,0.08,0)
    sp.ImageRectSize = Vector2.new(230,200)
    script.Parent.TextLabel.TextColor3 = Color3.new(0/255,255/255,255/255)
    moved = false
    if moved == false then
        moved = true
        for i=1,5 do
            sp.Position = sp.Position + UDim2.new(0.01,0,0,0)
            wait(0)
            if i == 5 then
                moved = false
            end
        end
    end
end)
script.Parent.MouseLeave:connect(function()
    sp.Image = "http://www.roblox.com/asset/?id=154945380"
    sp.Size = UDim2.new(0.3,0,0.08,0)
    sp.ImageRectSize = Vector2.new(150,200)
    script.Parent.TextLabel.TextColor3 = Color3.new(255/255,255/255,255/255)
    moved = false
    if moved == false then
        moved = true
        for i=1,5 do
            sp.Position = sp.Position - UDim2.new(0.01,0,0,0)
            wait(0)
            if i == 5 then
                moved = false
            end
        end
    end
end)

script.Parent.MouseButton1Click:connect(function ()
    for i = 0,10 do
        sp.Parent.Frame.BackgroundTransparency = sp.Parent.Frame.BackgroundTransparency - 1
    end
    script.Parent.Visible = false
    script.Parent.TextLabel.Visible = false
    local cam = game.Workspace.CurrentCamera
    cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    cam.CameraType = "Custom"
    wait(2)
    for i = 0,10 do
        sp.Parent.Frame.BackgroundTransparency = sp.Parent.Frame.BackgroundTransparency + 1
    end
    script.Parent.Parent:Destroy()
end)

So the first two functions are perfect, the 3rd one is were the prblem is. When you click on the button, its supposed to let the entire screen black, make the guis from the menu invisible, fix the camera to the character, make the game visible again and delete the gui. My problem is the when its supposed to fix the camera to custome on the character, the camera bugs, and stay on place, i cant free move the camera anymore. Help?

Answer this question