I tried the blog, I tried a bit of free models, I even tried my own. But I wanted to make a camera that is only focused on that one brick and I even made it a localscript I honestly dont see how it's not working
I have already answered this question here.
I emphasize that you must thoroughly search through other questions first because this is very similar.
So I will just copy and paste it:
You want to use Coordinate frame , it has two parameters:
It can set a position for the camera
It can set what the camera is facing
More detailed explaination:
CoordinateFrame:
First of all, CoordinateFrame is the extended name of CFrame. The CoordinateFrame property of the camera is simply the position of the camera.
game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(10,50,30) -- Positions camera at 10, 50, 30
Focus:
The Focus property is simply that the camera is looking at. To set the Focus property, you would do it the same was as CoordinateFrame:
game.Workspace.CurrentCamera.Focus = CFrame.new(0,10,0) -- Makes the camera look at 0, 10, 0
Setting the Focus will automatically rotate the camera in it's CoordinateFrame position.
Locking the camera:
Sadly, setting these properties does not lock the camera's position. The player can still rotate and move the camera around at their will. Currently there is no efficient way to go about solving this, that I know of. (Can someone second this?)
For now, the only way to lock the camera is to set a continuous loop. Example:
while true do game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(10,50,30) game.Workspace.CurrentCamera.Focus = CFrame.new(0,10,0) wait() end
For your use: Make the camera:
Player = game.Players.LocalPlayer Camera = Player.Camera
The CoordinateFrame slightly out from the part
Part = --Part's parenting Camera.CoordinateFrame = Part.Position + Vector3( 5, -5, 0)
And the Focus, focused on the part:
Camera.Focus = Part.Position
Altogether: (This should work)
Player = game.Players.LocalPlayer Camera = Player.Camera Part = --Part's parenting Camera.CoordinateFrame = Part.Position + Vector3( 5, -5, 0) Camera.Focus = Part.Position
I think I may have the answer to your question.
NOTE: In order for this to work. The script must be a LOCALSCRIPT placed inside StarterPack, StarterGui, or anywhere inside a player, or a player's character!
EDIT: I am making a script that changes the camera's subject to a part in Workspace named "Part" when you push F, then puts the focus back onto the player by pushing F again. I will point out which code to use when taking code from this script
local Player = game.Players.LocalPlayer --Get the Player local mouse = Player:GetMouse() --Get the Player's Mouse local Focused = false --To get the camera place this variable at the top of your localscript local Camera = game.Workspace.CurrentCamera --WARNING: Try this from a Normal script and the camera can NOT be accessed! Use a LocalScript! mouse.KeyDown:connect(function(key) --Wait for a key to be pressed if key == "f" then --If the key was f then if not Focused then --If the camera is NOT focused then Focused = true --Focused is now true --Place this where you would like to change the camera's subject to the part. BE SURE TO CHANGE 'game.Workspace.Part'! Camera.CameraSubject = game.Workspace.Part --Change the subject to game.Workspace.Part -- Camera.CameraType = "Attach" --If you want the player to be unable to turn the camera left and right Uncomment this line! elseif Focused then --If it is focused then Focused = false --Make focused false --Place this where you would like the camera to go back to it's original view. Camera.CameraSubject = Player.Character.Humanoid --Change the camera to it's original view Camera.CameraType = "Custom" --Allow the camera to be moved around freely end end end)
Did this help? Click the "Accept Answer" button below my character for you and me to receive reputation!