Loading Screen | Camera Issue

Hello! So I made this Loading Screen, which gets the players camera, and parent’s it to this part in the Workspace. When the player clicks a button, it will change their camera back to their Humanoid, and delete the play button, and blur. However, there are no errors, the camera doesn’t get parented to the brick, and when you click the button, it doesn’t delete anything. Please help!

Script:

local MenuCamera = game.Workspace:WaitForChild("MenuCamera") 
local PlayButton = script.Parent:WaitForChild("PlayButton")
-------------------------------------------
local LoadBlur = Instance.new("BlurEffect")
LoadBlur.Parent = game.Lighting
LoadBlur.Name = "LoadBlur"
LoadBlur.Enabled = true
LoadBlur.Size = 24
-------------------------------------------------
game.Players.PlayerAdded:Connect(function(Player)
	local Camera = Player.Character:WaitForChild("Camera")
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.Parent = MenuCamera
---------------------------------------------------
	PlayButton.MouseButton1Click:Connect(function()
		LoadBlur:Destroy()
		PlayButton:Destroy()
		Camera.CameraType = Enum.CameraType.Custom
	end)
end)

Parenting the camera won’t do anything. You need to change the CFrame of the camera.

Oh! Okay, thank you! <3 (text so i can send this)

Player Cameras cannot be accessed by the server. You’ll have to change the camera on the client. Try sending a RemoteEvent to the client, with the desired CFrame. For example:

Server:

local Remote = game:GetService("ReplicatedStorage"):WaitForChild("<REMOTENAME>")
local CamCF = DesiredCF -- Replace with CFrame you want to use
game:GetService("Players").PlayerAdded:Connect(function(plr)
	Remote:FireClient(plr,CamCF)
end)

Client:

local Remote = game:GetService("ReplicatedStorage"):WaitForChild("<REMOTENAME>")

Remote.OnClientEvent:Connect(function(CF)
	local Cam = workspace.CurrentCamera -- CurrentCamera is a property of workspace
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CFrame = CF
end)

This doesn’t encompass undoing the action, but if you need help with that, just reply.

use this

Camera.CFrame = MenuCamera.CFrame

What would I change the CamCF? Just the CFrame (CFrame.new()) or the actual players camera change CFrame? (Player.Camera = CFrame.new(workspace.MenuBrick)

I will try that! Thanks for the reccomendation!

1 Like

Doesn’t seem to work. Heres the script:

local MenuCamera = game.Workspace:WaitForChild("MenuCamera") 
local PlayButton = script.Parent:WaitForChild("PlayButton")
-------------------------------------------
local LoadBlur = Instance.new("BlurEffect")
LoadBlur.Parent = game.Lighting
LoadBlur.Name = "LoadBlur"
LoadBlur.Enabled = true
LoadBlur.Size = 24
-------------------------------------------------
game.Players.PlayerAdded:Connect(function(Player)
	local Camera = Player.Character:WaitForChild("Camera")
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = MenuCamera.CFrame
	---------------------------------------------------
	PlayButton.MouseButton1Click:Connect(function()
		LoadBlur:Destroy()
		PlayButton:Destroy()
		Camera.CameraType = Enum.CameraType.Custom
	end)
end)

is that a localscript or a sever script?

Server script! (text so i can send this)

try this and make it a localscript

local MenuCamera = game.Workspace:WaitForChild("MenuCamera") 
local PlayButton = script.Parent:WaitForChild("PlayButton")
-------------------------------------------
local LoadBlur = Instance.new("BlurEffect")
LoadBlur.Parent = game.Lighting
LoadBlur.Name = "LoadBlur"
LoadBlur.Enabled = true
LoadBlur.Size = 24
-------------------------------------------------
game.Players.PlayerAdded:Connect(function(Player)
	local Camera = workspace.CurrentCamera
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = MenuCamera.CFrame
end)

PlayButton.MouseButton1Click:Connect(function()
	LoadBlur:Destroy()
	PlayButton:Destroy()
	Camera.CameraType = Enum.CameraType.Custom
end)

Okay, so I tried it, and it solved the not deleting the blur, and button, but the camera is still glitched!

show me a screenshot of the output and show me the camera in-game

I use the developer consle, but I will give you a video of when I join!

When I join:

When I click the Play Button:

Developer Consle:

Sorry for the late response! You’d want to set that to the CFrame you want the camera to go to.

Oh, okay! I will try that right now.

It’s not calling PlayerAdded, try this:

local MenuCamera = game.Workspace:WaitForChild("MenuCamera") 
local PlayButton = script.Parent:WaitForChild("TextButton")
local Camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
repeat wait() until player ~= nil


local LoadBlur = Instance.new("BlurEffect")
LoadBlur.Parent = game.Lighting
LoadBlur.Name = "LoadBlur"
LoadBlur.Enabled = true
LoadBlur.Size = 24

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = MenuCamera.CFrame
Camera.CameraSubject = MenuCamera
print("Set")

PlayButton.MouseButton1Click:Connect(function()
	LoadBlur:Destroy()
	PlayButton:Destroy()
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
end)


And the first one is a LocalScript, and the second is a server script, correct?

this would have to be a local script ^^ I just tried it and worked good for me.