I’m trying to make the main menu where the player’s camera is staring at a block look like this:
but whenever I join the game the camera isn’t working how I want it too.
This is how my script looks.
Also please note that I’m very new to scripting.
I’m trying to make the main menu where the player’s camera is staring at a block look like this:
Well, you’re on the right path. The only issue is that you didn’t set the CFrame of the camera. Add that in and you’ll be good to go. Keep Focus in since it has relevance to rendering.
Just above where you set Focus, add this:
camera.CFrame = target.CFrame
See the Camera documentation page for more information.
Thank you for responding but it still doesn’t appear to work.
That’s a different error from your end unrelated to the Camera CFrame. Remove the first end and remove the brackets from the leftover one.
local function updateCamera()
end
Ok, I thank you again for helping but it still doesn’t work for some reason.
I checked the output just in case:
this is all I found there.
Next, I changed the brick name to this:
But it still doesn’t work so I’m wondering what I’m doing wrong.
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Target = workspace:FindFirstChild("test object") or workspace:WaitForChild("test object")
local Camera = workspace.Camera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CFrame.new(Target.CFrame.p + Target.CFrame.lookVector * 25, Target.CFrame.p)
--I'd recommend changing 25 as it is the distance from the part.
wrote this little bit up and tested it out in a place of my own, and as long as you have it in a local script it should work fine.
Might as well point out: this is redundant. WaitForChild performs a FindFirstChild call internally and if that call fails, then it yields the thread until a child exists that matches the passed name. You only need to use WaitForChild here.
You see, something like that would seem self explanatory as it states “as soon as it is ready”, but I just never thought about it.