Answered by
6 years ago Edited 6 years ago
03 | function MoveCamera(cframe, button) |
04 | local prevCFrame = game:GetService( "Workspace" ).Camera.CFrame |
05 | local camType = game:GetService( "Workspace" ).Camera.CameraType |
07 | game:GetService( "Workspace" ).Camera.CameraType = Enum.CameraType.Scriptable |
09 | game:GetService( "Workspace" ).Camera.CFrame = cframe |
11 | buttonEvent = button.MouseButton 1 Click:connect( function () |
12 | game:GetService( "Workspace" ).Camera.CameraType = camType |
13 | game:GetService( "Workspace" ).Camera.CFrame = prevCFrame |
15 | buttonEvent:Disconnect() |
edit:
1 | local prevCFrame = game:GetService( "Workspace" ).Camera.CFrame |
2 | local camType = game:GetService( "Workspace" ).Camera.CameraType |
Stores the players camera data.
1 | game:GetService( "Workspace" ).Camera.CameraType = Enum.CameraType.Scriptable |
Removes the ability for the player to move the camera.
1 | game:GetService( "Workspace" ).Camera.CFrame = cframe |
Sets the camera cframe to the one used in the function.
1 | game:GetService( "Workspace" ).Camera.CameraType = camType |
2 | game:GetService( "Workspace" ).Camera.CFrame = prevCFrame |
Sets the camera data back to before it was changed, fixes the camera.
1 | buttonEvent:Disconnect() |
Disconnects the event so it cannot run again.
Hopefully the edit helps.