This is a problem to me.. this gui is intended to serve as a character selection. When you click the button your camera position will change to the target camera. This works fine, the problem is when i click another button the script on previous button is still working which mess up the camera. i tried disabling the script on textbutton1 but it will not work..
TextButton1 script
function click() local target = game.Workspace.CHAR1 -- The target model local camera = game.Workspace.CurrentCamera camera.CameraSubject = target local angle = 0 while wait() do camera.CoordinateFrame = CFrame.new(4.5, 4, 6.5) ---- Position of camera * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 0) end end script.Parent.MouseButton1Down:connect(click)
button 2
function click() local target = game.Workspace.CHAR2 -- Target model local camera = game.Workspace.CurrentCamera camera.CameraSubject = target local angle = 0 while wait() do camera.CoordinateFrame = CFrame.new(4.5, 4, -7.5) --- camera position * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 0) end end script.Parent.MouseButton1Down:connect(click)