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 » Scripters
Home Search
 

Re: Camera Rotate Help

Previous Thread :: Next Thread 
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 12:09 AM
I will give 50 R$ to who ever can help me properly.

I need a script that will lock my characters camera behind him and will rotate with him.
so if I flipped my character at a 45 degree the camera will flip 45 degrees. Any degree in all directions.
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 01:01 AM
100 R$
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 01:01 AM
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local rootPart = character:WaitForChild("HumanoidRootPart")
local camera do
workspace.Changed:connect(function()
camera = workspace.CurrentCamera
end)
camera = workspace.CurrentCamera
end

game:GetService("RunService").RenderStepped:connect(function()
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = rootPart.CFrame - rootPart.CFrame.p+ rootPart.CFrame*Vector3.new(0,1.5,10)
end)



To test, make the humanoid platform stand.
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 01:13 AM
problem. dosnt seem to be working. would it help to say my character dosnt have a humanoidrootpart, i changed it to Head but it didnt work.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 01:14 AM
Output? Works fine for me. Only issue is that you can't really walk backwards unless you want to write a custom controller.
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 01:17 AM
Camera is not a valid member of workspace
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 01:21 AM
Quick list:
It should be a local script.
It should be in the playergui or backpack.
Are you using a custom character? Otherwise there is a HumanoidRootPart (does not show up in explorer, but it is there)
Can you post the code you tried to run? Because my code cannot produce that error since I always index workspace.CurrentCamera (which would return nil or the camera since it is a property of workspace and I am not actively trying to index an object).

Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 01:24 AM
You can test it here:
http://www.roblox.com/jordo-Camera-place?id=229167095
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 01:25 AM
Worked once i changed it to follow head and also put in gui, Thx, i havnt played roblox since 2010 how do i give you reward
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 01:35 AM
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local rootPart = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
if key:lower() == 's' then
humanoid.AutoRotate = false
repeat until mouse.KeyUp:wait():lower() == 's'
humanoid.AutoRotate = true
end
end)
local camera do
workspace.Changed:connect(function()
camera = workspace.CurrentCamera
end)
camera = workspace.CurrentCamera
end

game:GetService("RunService").RenderStepped:connect(function()
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = rootPart.CFrame - rootPart.CFrame.p+ rootPart.CFrame*Vector3.new(0,1.5,10)
end)


Fixed the backwards walk in case anyone else needs it.
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 01:58 AM
it seams when you die and respawn your camera dosnt
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 02:11 AM
Can you post the tweaked code? My guess is you moved the CameraType line outside of the renderstepped loop (I know guys, it is not actually a loop). This was to purposely placed to prevent the player respawn code to override the camera settings.
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 02:22 AM
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local rootPart = character:WaitForChild("Head")
local camera do
workspace.Changed:connect(function()
camera = workspace.CurrentCamera
end)
camera = workspace.CurrentCamera
end

game:GetService("RunService").RenderStepped:connect(function()
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = rootPart.CFrame - rootPart.CFrame.p+ rootPart.CFrame*Vector3.new(0,1.5,10)
end)--thx Casualist
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 02:28 AM
i put it in starter gui
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 02:28 AM
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
print("Character found")
local rootPart = character:WaitForChild("Head")
print("Head found")
local camera do
workspace.Changed:connect(function()
camera = workspace.CurrentCamera
end)
camera = workspace.CurrentCamera
end
print(player, Character, rootPart, camera)
print("Hooking up camera")
game:GetService("RunService").RenderStepped:connect(function()
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = rootPart.CFrame - rootPart.CFrame.p+ rootPart.CFrame*Vector3.new(0,1.5,10)
end)

Mind running this for diagnostics? Also is there a place I can test the error? It may have something to do with how you handle custom character creation.
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 02:31 AM
Character found
Head found
Player1 nil Head Camera
Hooking up camera
Character found
Head found
Player1 nil Head Camera
Hooking up camera
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 02:34 AM
lol, I capitalized character on accident. And that is that the output when you experience the glitch of the camera not respawning with the player?
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 02:35 AM
*is that the output
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 02:36 AM
ya, i put character lowercase and it dosnt have an error it just dosnt connect
Character found
Head found
Player1 Player1 Head Camera
Hooking up camera
Character found
Head found
Player1 Player1 Head Camera
Hooking up camera
is all it puts
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 02:39 AM
Is there a server I can test this on? If it is getting to the Hooking up camera line, it must be connecting.


Just a thought, since you are using custom characters it might be picking up the old character before you create a new one.
Report Abuse
jordo is not online. jordo
Joined: 13 Apr 2007
Total Posts: 265
22 Mar 2015 02:40 AM
my 15 place is the only on that has it
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 02:42 AM
local player = game:GetService("Players").LocalPlayer
local character do
player.CharacterAdded:connect(function()
character = player.Character
end)
character = player.Character or player.CharacterAdded:wait()
end


local camera do
workspace.Changed:connect(function()
camera = workspace.CurrentCamera
end)
camera = workspace.CurrentCamera
end

game:GetService("RunService").RenderStepped:connect(function()
local rootPart = character:FindFirstChild("Head")
if not rootPart then return end
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = rootPart.CFrame - rootPart.CFrame.p+ rootPart.CFrame*Vector3.new(0,1.5,10)
end)--thx Casualist
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
22 Mar 2015 02:44 AM
Your game is friends only at the moment
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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