|
| 07 May 2013 11:35 AM |
I want to use LocalScript to onEquip tool do something with the CurrentCamera. On unequipp, center it back to the player. PROBLEM 1: CoordinateFrame works fine, but Focus doesn't work. It still focuses "somewhere". No matter what positions I write. PROBLEM 2: I don't know how to center it back to the player. Please help. CODE: local camera = workspace.CurrentCamera -- get the camera
function unequipp(mouse) --get player and center the camera end
function equipp(mouse) camera.CameraType = "Scriptable" --to stop player manipulating camera.CoordinateFrame = CFrame.new(17,30,0) -- works fine x = game.Workspace.CesiSpawn.Position.X --CesiSpawn is a part in the Workspace y = game.Workspace.CesiSpawn.Position.Y z = game.Workspace.CesiSpawn.Position.Z print(workspace.CurrentCamera.Focus) -- debug camera.Focus = CFrame.new(x,y,z) print(workspace.CurrentCamera.Focus) -- focus "changed" but Camera still not pointing to the CesiSpawn Part end
script.Parent.Parent.Unequipped:connect(unequipp) --calling script.Parent.Parent.Equipped:connect(equipp)
------------------------------------------------------------------------------------------------------- Code end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 16 May 2013 02:14 PM |
| Ok done now only one problem - doesn't work in Online, |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 16 May 2013 02:28 PM |
| Make sure you are using local script and if it's still not working, add wait() at beginning of it. |
|
|
| Report Abuse |
|
|
NOWAYOUT2
|
  |
| Joined: 24 Jul 2011 |
| Total Posts: 5556 |
|
|
| 16 May 2013 02:59 PM |
I agree with zars... Because he's clearly better than me at scripting...
[~Achievement Unlocked~] |
|
|
| Report Abuse |
|
|