Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Camera rotate to head x,y,z?

Asked by
Hero_ic 502 Moderation Voter
9 years ago

I do not know if I worded the title right anyway...

What I'm Trying To Do I'm trying to make the current camera go to the postition of the players head. I have achieved this but It does not rotate to the y z or x of the head. Also for some reason it only follows the player if its on track. Code:

local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.currentcamera
if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end
camera.CameraType = 'Track'; 
camera.CameraSubject = character.Head;`

So if you could help me that would be very appreicated!

Thanks ~KiHeros

0
Ah, try setting the camera to be 'Fixed' instead of 'Track' Xetrax 85 — 9y
0
Sadly that does not work :/ Hero_ic 502 — 9y
0
Drat... You might also try setting the Focus property of the Camera first, before you set the subject, I myself am trying to achieve the same goal as you are... and not getting much luck... :| Xetrax 85 — 9y
0
oh man. Hero_ic 502 — 9y
View all comments (3 more)
0
lol... I want it for a nice death effect script... so far I can't get it to go to the Head and look where the head is pointing, but are you aiming for a First Person camera? Xetrax 85 — 9y
0
yeah xD I have it fully set up except for it not following the head y and x when i turn it up and down Hero_ic 502 — 9y
0
Check my answer! Xetrax 85 — 9y

2 answers

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Helped on stypi <3

Ad
Log in to vote
0
Answered by
Xetrax 85
9 years ago

If you're aiming for a FP camera, then do this:

local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.currentcamera
if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end
player.CameraMode= 'LockFirstPerson';   --This automatically sets the cam to First Person(Yay...)

Hope that helps!

0
UHM... There is a problem I just noticed, roblox removed the "LockFirstPerson" mode... sorry... Xetrax 85 — 9y
0
Actually they have not but that is not the problem Hero_ic 502 — 9y
0
I edited it, should work now... Xetrax 85 — 9y
0
I do not actually want it to be in first person that is why I'm making my own first person camera I just need the camera to follow the y of the head as in the actual first person mode the camera moves to fast and the head does not keep up with it so I'm trying to get the camera to follow the y position of the head. Hero_ic 502 — 9y

Answer this question