generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Intro Camera

Previous Thread :: Next Thread 
Scarvis is not online. 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 is not online. 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 is not online. Scarvis
Joined: 02 Dec 2008
Total Posts: 14213
13 Jul 2014 10:20 AM
That doesn't work
Report Abuse
Scarvis is not online. Scarvis
Joined: 02 Dec 2008
Total Posts: 14213
13 Jul 2014 11:54 AM
b
Report Abuse
4567777 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 4567777
Joined: 13 Jul 2013
Total Posts: 128
13 Jul 2014 12:37 PM
just the one in workspace
Report Abuse
Scarvis is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image