How to make a play button GUI, with a special camera to view a certain area

I need help making a camera to view a certain area of the map. Such as done in Vesteria. I am not sure how to do this, I already have my script:

script.Parent.MouseButton1Click:connect(function()

game:GetService("TeleportService"):Teleport(4569003170)

end)

Is there a way to achieve doing what I need done? If so, please tell me below! Thanks!

1 Like

To set the camera to focus on just on part?
For that you would access the current camera, like :

local camera = workspace:WaitForChild(“CurrentCamera”)
local target = workspace:WaitForChild(“Part”)

camera.CameraType = Enum.CameraType.Scriptable
		 camera.CameraSubject = target 
	      camera.CFrame = target.CFrame  
	       camera.FieldOfView = 46     
        camera:WorldToViewportPoint(target.CFrame)
1 Like

@XxELECTROFUSIONxX

Would this be done by me making a part under “camera” and inserting a local script into the part?

As currently, I’ve done what you told me. As has not worked.

(I don’t script, this is why I’m asking.)

You wont need to Parent anything to the camera , use the code in a local script in starter player scripts

Also this is just a simplified demonstration, changing the FoV is unnecessary.

Alright. Thanks so much for the help, this really helps me with what I was stuck with.

But, in starter player scripts should I still use the part and everything?

The part , in my code the target , will have to be left alone in workspace, we’re only referencing it for it’s CFrame and to make it the camera’s subject.

Edit :

Put the part in workspace, yes.But remember it will only set the player’s view to the part’s CFrame , not set it back.

So leave the local script in workspace, and the part in starter player scripts?

I’m sorry for asking so many questions, I’m really not good at scripting.

1 Like

What I am doing, if correct, is not working. I have the part in workspace with the script provided, and the local script in StarterPlayerScripts, and what I need done is not working? Have I done something wrong?

Please also make sure you’ve referenced the right part (the correct name and directory in the script ) and made necessary adjustments.

Note : my provided code was just an outline of what you’d do something similar.

As I said before, I don’t know how to script. But the part for the camera is just called “Part” and the adjustments already there are fine.

EDIT:

My current script is…
local camera = workspace:WaitForChild(“CurrentCamera”)

local target = workspace:WaitForChild(“MenuMain”)

camera.CameraType = Enum.CameraType.Scriptable

camera.CameraSubject = target

camera.CFrame = target.CFrame

camera.FieldOfView = 46

camera:WorldToViewportPoint(target.CFrame)

This works for me:

local CameraPart = workspace.CameraPart
local Camera = workspace.CurrentCamera

repeat Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CFrame = CameraPart.CFrame

script.Parent.MouseButton1Click:Connect(function()
    Camera.CameraType = Enum.CameraType.Custom
end) 

Where are you putting the script? Is there a part in starterplayerscripts? Or the local script in starterplayerscripts? (or is the part in workspace?)

A local script in the GUI button in the menu.

Alright, is there a part though? What I’m trying to achieve, is not spawn the player, but have a part facing a certain area of the map for the loading area. So, basically not showing the spawned character, but showing some kind of building.

Yes. You create a part in workspace named “CameraPart” and move it to where you want the camera to be.

Alright. And if this doesn’t work, I’ll come back to you. :slight_smile:

This is my result:

Thing I’m trying to do:

Do you get any errors in Output?

I don’t believe so…
14:49:34.127 - Vulcron auto-recovery file was created

Loading Tree Gen…

Finished Loading Tree Gen

Loading Tree Gen…

Finished Loading Tree Gen

14:49:36.528 - Touched is not a valid member of ServerScriptService

14:49:36.530 - Stack Begin

14:49:36.531 - Script ‘ServerScriptService.Script’, Line 36

14:49:36.532 - Stack End

14:52:18.222 - Cannot Teleport in the Roblox Studio.

14:52:18.223 - Stack Begin

14:52:18.224 - Script ‘Players.Disparrel.PlayerGui.ScreenGui.ImageButton.TextButton.LocalScript’, Line 3

14:52:18.224 - Stack End