How can I set a custom camera when the player’s character has not loaded yet? CharacterAutoLoads is set to false. It made a script clone the screengui into playergui when player joins but it doesn’t work
My starter camera script inside a screen gui in StarterGui
-- Object Referencing
local cameraFolder = game.Workspace:WaitForChild("Cameras")
local starterCamera = cameraFolder:WaitForChild("StarterCamera")
local attackerCamera = cameraFolder:WaitForChild("AttackerCamera")
local defenderCamera = cameraFolder:WaitForChild("DefenderCamera")
local camera = game.Workspace.CurrentCamera
print("Working on it...")
repeat
camera.CameraType = Enum.CameraType.Scriptable
task.wait(0.1)
until camera.CameraType == Enum.CameraType.Scriptable
print("Complete")
camera.CFrame = starterCamera.CFrame
Can you also share the script that copies the startergui? It’s also important that the script that copies it is either a local script in ReplicatedFirst, or a server script in ServerScriptService.
-- Global Variables
local Players = game:GetService("Players")
local Teams = game.Teams
Players.PlayerAdded:Connect(function(player)
print(player.Name.." has joined.")
script.ScreenGui:Clone().Parent = player.PlayerGui
print("Done")
end)
It prints Done but not Working on it... and sends
Infinite yield possible on 'Workspace.Cameras:WaitForChild("StarterCamera")' - Studio
20:51:43.193 Stack Begin - Studio
20:51:43.193 Script 'Players.TheDiamondKing_21.PlayerGui.ScreenGui.CameraHandler', Line 3 - Studio - CameraHandler:3
20:51:43.193 Stack End - Studio
Infinite yields may happen for :WaitForChild() because the child that is being acquired might not be there. You should check if all the camera parts are spelled the same as in the local script
You can try putting print()s in between the :WaitForChild()s to see where the script stops.
You can find a tool in the view section called “find all” or something like that. You can basically search a term to find that term in all scripts. Try searching for :Destroy(),.Parent =, etc.
It also might be possible when the camera psrts are unanchored
Ok, I see my issue now, the problem is that the parts in workspace do not load until the player’s character loads, I will have to clone everything into the workspace, thank you for your assistance.
Thank you so much, thank you!!! Disabling that property fixed everything, now my starter camera works perfectly fine and smooth with the camera thingy!!!