Hello i want to MMORPG game . But idk how i can change the camera position. I watched tons of video but they are doing only firstperson. I want to do something similar to the camera position in the photo. And I want to allow them to zoom in and out of the camera, but I don’t want them to switch to first person. If you have any articles or tutorial videos that I need to know, I would appreciate it if you could share them.
you can set the Humanoid.CameraOffset property which is self explanatory, and then set the mincamerazoom which is there somewhere on starterplayer if i remember correctly
local RunService = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local Char = Player.Character
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
local Offset = Vector3.new(.001, 10 , 15)
RunService.RenderStepped:Connect(function()
local CharPos = Char.HumanoidRootPart.Position
local CameraPos = CharPos + Offset
Camera.CFrame = CFrame.new(CameraPos, CharPos)
end)
I tried this but camera is locked how can i fix this
This is not how Camera works. You would need to code a camera system of your own. The best method is what Herstal_PinkP90 has suggested that is to use the Humanoid.CameraOffset property like so:
local Game = game
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
local Offset = Vector3.new(0, 10 , 15)
Humanoid.CameraOffset = Offset
As for why the issue occurs, it’s because you are first of all setting your CameraType property to Scriptable which stops all Roblox Core Scripts from manipulating the camera. Next, you are setting the CFrame of the camera to the player’s HumanoidRootPart’s position with some offset which just makes it have no orientation and just be translated wherever the character walks to.
Whereas, using CameraOffset doesn’t stop Roblox Core Scripts from manipulating the camera and also properly adds an offset to the Camera.