Does anyone have any help for me, How do I make it so that when a player joins his camera is automatically set to a position (where a part is facing) the menu shows up, he clicks play, and the camera is reset? I know its a lot but its kinda simple asf. And maybe a way to like stop other things from happening like intermession
On a local script, you could attach a character-added event and then get the camera and set its focus part to what you want, and enable the UI.
local plr = game.Players.LocalPlayer
plr.CharacterAdded:Connect(function(char)
local cam = game.Workspace.Camera
cam.FocusPart = game.Workspace.camPart
end)
Please note that this is a very basic example and I do not have the time to make it any better as of now. You can detach the event once the player has clicked the play button or whatever they need to click on your menu.
how would i actually go about setting it to the plrs view
That sets it to the view of a part. Otherwise, you can set the Camera’s CFrame and set the camera type to Enum.CameraType.Scriptable.
This devhub article might be of use.
Just completly ingores and then gives me no errors
Those were irrelevant.
Show me your current script.
Same as yours just changed to my part and focus item
theres so many diffrent camera scripts tho im not sure if that matters
If you have multiple camera scripts, they are likely interfering with each other. Also, I did not have much time to write that. You should be debugging it and looking into how it works. Mess around with it in the command bar and change settings with the camera.
they are very advanced, ill try tho
Then have them disabled whilst you are doing your main menu thing.
Something like this should work, inside a gui;
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local menuPart = workspace:WaitForChild("MenuCam") -- change to yours
local gui = script.Parent
local playButton = gui:WaitForChild("Play") -- again, change to yours
local debounce = false
if not player.Character then -- if the character doesnt exist, wait until it does
player.CharacterAdded:Wait()
end
-- set the camera cframe to the menu cam part
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = menuPart.CFrame
-- when the button is pressed
playButton.Activated:Connect(function()
if debounce then return end -- cooldown so you cant double click and cause bugs
debounce = true
gui.Visible = false
-- resets the camera to the character
camera.CFrame = player.Character.PrimaryPart.CFrame -- not needed but I do it
camera.CameraType = Enum.CameraType.Custom
task.wait(.3)
debounce = false
end)
I think that would work
Also important note:
Make sure “ResetOnSpawn” I think it’s called is OFF
If it’s on it will rerun this code everytime you spawn
I disabled all the other camera scripts, it just faces the ground, doesnt show where the part is looking
It’ll face the front of the part, make sure the front face is looking where you want
as i said, it doesnt even use the part