Camera not going to player on run of studio

Hello! So basically when I press the “run” button, this bug occurs.

  1. I’m just trying to playtest my game, and I can’t since its broken.

  2. Basically after clicking the “run” button in studio, my custom loading screen kicks in (Works as intended) then after it disappears it should be the camera of the player. But its a random view of the world, then after a couple of seconds the camera goes to the player, and all GUI that is meant to run when a client joins the game just voids and doesn’t function.

  3. I’ve tried restarting studio multiple times, restarting my computer, disabling scripts, and removing the loading screen. Nothing I’ve tried is working. I haven’t inserted any malware, I’ve written all scripts by me.

Here are some photos:
Photo 1

Photo 2

In Photo 1, that is what is seen as soon as the loading screen goes. Then photo 2, is the player. (The character takes forever to load, idk why)

Honestly it’s pretty hard to diagnose the problem here since you provided us with absolutely 0 code, but I assume it’s because your game has too many parts and it takes an extremely long amount of time to load them all.

1 Like

As ramdoma said, please provide us with some code so we can assist you further with your problem.

Here:

LoadingScreenScript:

local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local replicatedStorage = game:GetService("ReplicatedStorage")

local contentProvider = game:GetService("ContentProvider")

local player = Players.LocalPlayer 
local playerGui = player:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
screenGui.Parent = playerGui

-- Create the background
local background = Instance.new("Frame")
background.Size = UDim2.new(0, 942, 0, 615)
background.BackgroundColor3 = Color3.fromRGB(0,0,0)
background.Parent = screenGui

-- Create the night sky
local starry_Night = Instance.new("ImageLabel")
starry_Night.Size = UDim2.new(1.254, 0, 1.023, 0)
starry_Night.Image = "rbxassetid://8822076596"
starry_Night.ImageTransparency = 0.1
starry_Night.Parent = screenGui
starry_Night.ImageColor3 = Color3.fromRGB(187, 200, 255)

-- Create the star
local starImage = Instance.new("ImageLabel")
starImage.Size = UDim2.new(0.7, 0, 0.737, 0)
starImage.Position = UDim2.new(0.195, 0, -0.002, 0)
starImage.ScaleType = Enum.ScaleType.Fit
starImage.BackgroundTransparency = 1
starImage.Image = "rbxassetid://8830218351"
starImage.ZIndex = 4
starImage.Parent = screenGui

-- Create the Text Icon
local text_Icon = Instance.new("ImageLabel")
text_Icon.BackgroundTransparency = 1
text_Icon.Size = UDim2.new(0.581, 0, 0.647, 0)
text_Icon.Position = UDim2.new(0.22, 0, 0.176, 0)
text_Icon.ZIndex = 5
text_Icon.Image = "rbxassetid://8821960649"
text_Icon.ScaleType = Enum.ScaleType.Fit
text_Icon.Parent = screenGui

-- Create the loadingBar
local loadingBar = Instance.new("Frame")
loadingBar.Size = UDim2.new(0.377, 0, 0.08, 0)
loadingBar.BackgroundColor3 = Color3.fromRGB(255, 234, 0)
loadingBar.Position = UDim2.new(0.322, 0, 0.828, 0)
loadingBar.ClipsDescendants = true
loadingBar.Parent = screenGui

	-- Create a UI Corner for loadingBar
local uiCorner_1 = Instance.new("UICorner")
uiCorner_1.CornerRadius = UDim.new(0, 35)
uiCorner_1.Parent = loadingBar

-- Create the progressBar
local progressBar = Instance.new("Frame")
progressBar.Size = UDim2.new(0, 0, 1.004, 0)
progressBar.BackgroundColor3 = Color3.fromRGB(253, 255, 197)
progressBar.Position = UDim2.new(0, 0, -0.004, 0)
progressBar.Parent = loadingBar

local uiCorner2 = uiCorner_1:Clone()
uiCorner2.Parent = progressBar

-- Create the loadingText
local loadingText = Instance.new("TextLabel")
loadingText.BackgroundTransparency = 1
loadingText.Size = UDim2.new(0.2, 0, 0.051, 0)
loadingText.Position = UDim2.new(0.41, 0, 0.841, 0)
loadingText.ZIndex = 2
loadingText.Font = Enum.Font.RobotoCondensed
loadingText.Text = "Loading..."
loadingText.TextScaled = true
loadingText.Parent = screenGui

ReplicatedFirst:RemoveDefaultLoadingScreen()

wait(4) -- Until start loading
local loadingCount = {
	[1] = "Loading",
	[2] = "Loading.",
	[3] = "Loading..",
	[4] = "Loading...",

}
local loopCounter = 0
local total = 16

for i = 1, total do
	
	loopCounter += 1
		
	progressBar.Size = UDim2.new(i/total + 0.5, 0, 1.004, 0)
	loadingText.Text = loadingCount[loopCounter]
		
	if loopCounter == 4 then 
		loopCounter = 0
	end
	
	if i >= 40 or progressBar.Size.X.Scale >= 1 then break end
	
	wait(0.4)
end

loadingText.Text = "Loading Complete!"

local loadingComplete = replicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("LoadingComplete")

screenGui:Destroy()

loadingComplete:FireServer(player)

PlayBtn and related GUI (That is meant to appear after the player loads in)

-- Services
local replicatedStorage = game:GetService("ReplicatedStorage")
local tweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local players = game:GetService("Players")

local player = players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

-- Folders
local remoteEvents = replicatedStorage.RemoteEvents
local remoteFunctions = replicatedStorage.RemoteFunctions
local timeFolder = replicatedStorage.Time

-- Remote Events/Functions
local startSessionHandler = remoteEvents:WaitForChild("StartSessionHandler")
local pressedPlay = remoteEvents:WaitForChild("PressedPlay")
local introGui = remoteEvents:WaitForChild("IntroGui")
local responseEvent = remoteEvents:WaitForChild("ResponseEvent")

-- Gui Elements
local gameGui = script.Parent:WaitForChild("GameGui")
local playBtn = gameGui.PlayBtn
--local gameIcon = gameGui.GameIcon
local text_Icon = gameGui.Text_Icon
local helpBtn = gameGui.HelpBtn
local creditsBtn = gameGui.CreditsBtn
local storeBtn = gameGui.StoreBtn

-- Help Page
local helpFrame = gameGui.HelpFrame
local responseBox = helpFrame.ResponseBox
local titleText = helpFrame.TitleText
local send = helpFrame.SendBtn

local timeText = gameGui.TimeText

local currentTime = timeFolder.CurrentTime

-- Functions

local function showGui_Objects()
	text_Icon.Visible = true
	
	playBtn.Visible = true
--	storeBtn.Visible = true
--	creditsBtn.Visible = true
--	helpBtn.Visible = true
end

local function hideGui_Objects()
	text_Icon.Visible = false

	playBtn.Visible = false
--	storeBtn.Visible = false
--	creditsBtn.Visible = false
--	helpBtn.Visible = false
end

local function animate_TitleScreen_In()
	text_Icon.Position = UDim2.new(0.222, 0, 1, 0)
	playBtn.Position = UDim2.new(0.394, 0, 1, 0)
	storeBtn.Position = UDim2.new(0.394, 0, 1, 0)
	creditsBtn.Position = UDim2.new(0.394, 0, 1, 0)
	helpBtn.Position = UDim2.new(0.394, 0, 1, 0)
	
	text_Icon:TweenPosition(UDim2.new(0.222, 0, -0.195, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	playBtn:TweenPosition(UDim2.new(0.394, 0, 0.465, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	storeBtn:TweenPosition(UDim2.new(0.394, 0, 0.567, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	creditsBtn:TweenPosition(UDim2.new(0.394, 0, 0.668, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	helpBtn:TweenPosition(UDim2.new(0.394, 0, 0.766, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
end

local function animate_TitleScreen_Out()
	text_Icon.Position = UDim2.new(0.222, 0, -0.195, 0)
	playBtn.Position = UDim2.new(0.394, 0, 0.465, 0)
	storeBtn.Position = UDim2.new(0.394, 0, 0.567, 0)
	creditsBtn.Position = UDim2.new(0.394, 0, 0.668, 0)
	helpBtn.Position = UDim2.new(0.394, 0, 0.766, 0)
	
	text_Icon:TweenPosition(UDim2.new(0.222, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	playBtn:TweenPosition(UDim2.new(0.394, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	storeBtn:TweenPosition(UDim2.new(0.394, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	creditsBtn:TweenPosition(UDim2.new(0.394, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
	helpBtn:TweenPosition(UDim2.new(0.394, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
end

local function animate_HelpFrame_In()
	text_Icon.Position = UDim2.new(0.222, 0, -0.195, 0)

	text_Icon:TweenPosition(UDim2.new(0.222, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
end

local function animate_HelpFrame_Out()
	text_Icon.Position = UDim2.new(0.222, 0, -0.195, 0)

	text_Icon:TweenPosition(UDim2.new(0.222, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
end

local function sendBtn_func()
	local response = responseBox.Text
	local characterCount = string.len(response)

	if characterCount > 2000 then
		
		-- the response is TOO long
		print("ERROR - response could not be sent, as it exceeded the character limit.")
		responseBox.Text = ""

	elseif characterCount <= 2000 then
		-- the response is either 2000 characters or its smaller.
		print("Success! Your response has been sent, to the developers.")
		responseBox.Text = ""
		
		print(player)
		print(player.UserId)
		print(response)
		
		local userId = player.UserId
		
		responseEvent:FireServer(player,response)
	end
	
end

-- Events
local mouseTouching_PlayBtn = false

-- gameIcon final Pos: 0.172, 0, 0.071, 0
-- playBtn final Pos: 0.399, 0, 0.808, 0

-- gameIcon starting Pos: 0.653, 0, 1, 0
-- playBtn starting Pos: 0.399, 0, 1, 0
introGui.OnClientEvent:Connect(function()
--	print("INTRO")

	showGui_Objects()
	
	animate_TitleScreen_In()
end)

playBtn.Activated:Connect(function()
	
	pressedPlay:FireServer()
	startSessionHandler:FireServer()
	
	animate_TitleScreen_Out()
	
	wait(3)
	hideGui_Objects()
end)

It may be an issue of you not spawning the player.

No need to put player on first parameter when firing a remote event. When .OnServerEvent fired, the first parameter will always be the player who fire the remote event.

Sorry I didnt mean to reply to you

Make sure the CharacterAutoLoads property is enabled in the Players service.

Thanks for your help, for storing a lot of the big structures that are useless in the game, it all works now! Plus it probs didn’t help since there is roughly 200+ mesh/decal trees.

1 Like