Scarvis
|
  |
| Joined: 02 Dec 2008 |
| Total Posts: 14213 |
|
|
| 13 Jul 2014 01:30 AM |
I want this camera to spin around the Cam part for a game Im making, it needs to spin around for about three seconds then cuts back to the normal camera.
I'm trying to make it so it only works when the player enters, but it happens every time you respawn plus the camera never goes back to the player.. here is the script (Is a localscript inside StarterGui):
game.Players.PlayerAdded:connect(function(player) script.LocalScript:clone().Parent = player.CharacterAdded:wait() end)
local target = workspace.Cam local camera = workspace.CurrentCamera camera.CameraSubject = target local angle = 0 while wait() do camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 10) angle = angle + math.rad(1) end
wait(3)
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Custom"
|
|
|
| Report Abuse |
|
|
Tynexx
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 1559 |
|
|
| 13 Jul 2014 01:33 AM |
local target = workspace.Cam local camera = workspace.CurrentCamera camera.CameraSubject = target local angle = 0 local timeleft = 3
repeat camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 10) angle = angle + math.rad(1) wait(1) timeleft = timeleft - 1 until timeleft==3
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Custom" ~Tynexx |
|
|
| Report Abuse |
|
|
Scarvis
|
  |
| Joined: 02 Dec 2008 |
| Total Posts: 14213 |
|
| |
|
Scarvis
|
  |
| Joined: 02 Dec 2008 |
| Total Posts: 14213 |
|
| |
|
4567777
|
  |
| Joined: 13 Jul 2013 |
| Total Posts: 128 |
|
|
| 13 Jul 2014 12:07 PM |
it never goes back to the player because your while loop is never stopped I edited your script and added a timer to the loop
game.Players.PlayerAdded:connect(function(player) script.LocalScript:clone().Parent = player.CharacterAdded:wait() end)
local target = workspace.Cam local camera = workspace.CurrentCamera camera.CameraSubject = target local angle = 0
local init = tick()-- gets current tick while tick()-init<6 do --loop until time since init has surpassed 6 camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 10) angle = angle + math.rad(1) wait() end
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Custom" |
|
|
| Report Abuse |
|
|
Scarvis
|
  |
| Joined: 02 Dec 2008 |
| Total Posts: 14213 |
|
|
| 13 Jul 2014 12:19 PM |
| That works but I still have to problem of the camera moving every time they respawn |
|
|
| Report Abuse |
|
|
4567777
|
  |
| Joined: 13 Jul 2013 |
| Total Posts: 128 |
|
|
| 13 Jul 2014 12:22 PM |
put this into a normal script in workspace
game.Players.PlayerAdded:connect(function(player) local target = workspace.Cam local camera = workspace.CurrentCamera camera.CameraSubject = target local angle = 0 local init = tick()-- gets current tick while tick()-init<6 do --loop until time since init has surpassed 6 camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 10) angle = angle + math.rad(1) wait() end game.Workspace.CurrentCamera.CameraSubject = player.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Custom" end) |
|
|
| Report Abuse |
|
|
Scarvis
|
  |
| Joined: 02 Dec 2008 |
| Total Posts: 14213 |
|
|
| 13 Jul 2014 12:31 PM |
| Would I use the script in the StarterGui plus the one in the workspace or just one or the other? |
|
|
| Report Abuse |
|
|
4567777
|
  |
| Joined: 13 Jul 2013 |
| Total Posts: 128 |
|
| |
|
Scarvis
|
  |
| Joined: 02 Dec 2008 |
| Total Posts: 14213 |
|
|
| 13 Jul 2014 12:40 PM |
| What if I wanted the camera to focus on a certian position after it was done circling? Because I need this to be a team selection GUI so the camera wont really have go back to the player since they'll respawn anyways? |
|
|
| Report Abuse |
|
|