Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Locking a Camera on a character in thirdperson?

I want to make a MOBA-type game, like LoL, so I tried to script myself a thirdperson camera that follows you around from a set distance. So I checked the ROBLOX wiki and found some help. I found that you have to use a LocalScript and put it in the character when they spawn. So I used the script provided:

game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) script.LocalScript:clone().Parent = character end) end)

and found that it didn't actually add it in when I played on solo.

Furthermore, I don't think my actual camera setting script would work, because I just don't know what I'm doing. This is my LocalScript that I want to put into the character to change how they see things:

local cam = workspace.CurrentCamera

cam.CameraSubject = LocalScript.Parent.Head

cam.CameraType = "Track"

cam.Focus=CFrame.new(

The bottom one I was trying to make the tracking focus from a specific angle, but couldn't figure out how to do it. -_-

Please help. I'm imcompetent.

1 answer

Try this, it should work.

local player = game.Players.LocalPlayer

player.CameraMode = Enum.CameraMode.Classic
wait() 
player.CameraMode = Enum.CameraMode.LockDefault

If I helped, please leave a upvote. I am in the negative and I need to get back up. Thanks <3

11 comments

0

Does it allow people to turn their cameras? Because I don't want people to be able to do that. Also, which script do I put it in?

0

If you want to force first person upon entering and resetting, put the following code in a LocalScript and insert the LocalScript into game.StarterPack or game.StarterGui.

0

Sorry, I meant third person. I am making a game with First Person and I keep forgetting you need third. It should still work anyhow.

0

Hm. It didn't work. I put the script you gave me in the starterpack as a local script, and nothing happened.

0

That's odd, because it worked just fine for me.

0

Even when I used 3rdPerson mode it worked... try to put it in starterGui.

0

I put it in the StarterGui and it's not doing it... I made a script testing place, and it's on my account if you want to check it out...

0

Awful odd... Sorry. Try one last thing please. Try editing line5 to player.CameraMode = Enum.CameraMode.LockDefault

0

Okay, you got the distance locked. How do I get the camera to be fixed at a certain angle?

0

Do you mean, like, change the pointed angle of the camera?

0

Keeping it in thirdPerson tho.

This discussion is preserved as it was. New answers, comments, and votes are closed.