Gojira34
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 1040 |
|
|
| 28 Oct 2011 10:04 PM |
| How do I check how far a Player's camera is zoomed out? |
|
|
| Report Abuse |
|
|
aboy5643a
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 2785 |
|
|
| 28 Oct 2011 10:06 PM |
mag = (LocalPlayer.Character.Head.Position - workspace.CurrentCamera.CoordinateFrame).magnitude.
returns the distance from head to camera. |
|
|
| Report Abuse |
|
|
Gojira34
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 1040 |
|
| |
|
Gojira34
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 1040 |
|
|
| 28 Oct 2011 10:11 PM |
I can't get this to work. Can you see any errors?
wait(1) local camera = game.Workspace.CurrentCamera local amount = game.Players.LocalPlayer:findFirstChild("Zoom") while wait(.5) do local mag = (game.Players.LocalPlayer.Character.Head.Position - camera.CoordinateFrame).magnitude if mag > amount.Value then script.Parent.Block.Visible = true else script.Praent.Block.Visible = false end end
Output: Fri Oct 28 21:09:53 2011 - Players.Player.PlayerGui.CameraLock.Restrict:5: bad argument #2 to '?' (Vector3 expected, got userdata) Fri Oct 28 21:09:53 2011 - Script "Players.Player.PlayerGui.CameraLock.Restrict", Line 5 Fri Oct 28 21:09:53 2011 - stack end |
|
|
| Report Abuse |
|
|
Gojira34
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 1040 |
|
|
| 28 Oct 2011 10:11 PM |
| (Aside from the typo on line 9 lol) |
|
|
| Report Abuse |
|
|
aboy5643a
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 2785 |
|
|
| 28 Oct 2011 10:13 PM |
CoordinateFrame.p
CoordinateFrame is a CFrame value... And doesn't apply to magnitude so use the p property of CFrame (position) |
|
|
| Report Abuse |
|
|
Gojira34
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 1040 |
|
|
| 28 Oct 2011 10:17 PM |
| Okay, its working now. Thanks! |
|
|
| Report Abuse |
|
|