I have a script, which parents the Screen GUIs to Player Gui, because I disabled CharacterAutoLoads. I have been using this until I started the game with 2 players and realized the GUIs will only be visible for the first player. This is how it worked:
Script:
local ius = game.StarterGui:GetChildren()
for _, v in ipairs(ius) do
v.Parent = player.PlayerGui
end
Video:
After adding “Clone()”
Script:
local ius = game.StarterGui:GetChildren()
for _, v in ipairs(ius) do
v:Clone().Parent = player.PlayerGui
end
The script is inside a CharacterAdded function with the rest of the code which changes some GUI properties, the only thing that doesnt work there is the camera change.
It would be nice to see other context like other code snippets or console. Are you sure the character is properly being spawned?
From what I can see from the examples, both cases seems to fire the deploy:31 line, but only the first example triggers a line in Script:8. Would this be an issue?
Thank you for your answer. There is no error or anything in the console. The “deploy:31” prints the character that the player will use and yes, it spawns and the “script:8” its not related to this, its a bombing system that starts at random and just started faster than the second one. I think I found the error. It may be that when I clone the Screen Gui, Im doing it from the server so the lines about the camara wouldn’t take effect, because the server doesnt recognize the player’s camera.
To avoid headaches in the future, LocalScripts under PlayerScripts (from StarterPlayerScripts) will still run without having to spawn a character. I would recommend cloning your gui from there.
I printed the camera, camera type and camera subject before and after changing the camera properties, somehow the camera type is set on custom, when is on scriptable and the camera subject is the humanoid
(the blue thing its before and the red one its after)
Sorry, here is the rest of the characteradded function:
game.Players.LocalPlayer.CharacterAdded:Connect(function(char)
print(workspace.CurrentCamera)
print(workspace.CurrentCamera.CameraType)
print(workspace.CurrentCamera.CameraSubject)
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
workspace.CurrentCamera.CameraSubject = char
print(workspace.CurrentCamera)
print(workspace.CurrentCamera.CameraType)
print(workspace.CurrentCamera.CameraSubject)
script.Parent.Parent.Parent.Visible = false
local captures = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Capture"):GetChildren()
for _, i in ipairs(captures) do
if i.Name ~= "aviso" then
i.Visible = true
end
end
if workspace.E.Capturado.Value == false then
script.Parent.Parent.Parent.Parent.Parent.Capture.mapa.Text = "Mannerheim Line: Main Line of Defense, Summakulä"
elseif workspace.D.Capturado.Value == false then
script.Parent.Parent.Parent.Parent.Parent.Capture.mapa.Text = "Mannerheim Line: Artillery Positions"
elseif workspace.C.Capturado.Value == false then
script.Parent.Parent.Parent.Parent.Parent.Capture.mapa.Text = "Mannerheim Line: Defensive Position SK10"
elseif workspace.B.Capturado.Value == false then
script.Parent.Parent.Parent.Parent.Parent.Capture.mapa.Text = "Mannerheim Line: Supply Station"
elseif workspace.A.Capturado.Value == false then
script.Parent.Parent.Parent.Parent.Parent.Capture.mapa.Text = "Mannerheim Line: Main Defensive Bunker SK18"
end
end)
Although messy, it seems fine. What about your menu camera code? Are you properly disconnecting/destroying whatever is handling the menu camera movement?