Ive been trying to make a team change gui, where when you first join the game you are looking over a baseplate, due to camera manipulation. Then when you change the team, you spawn with the normal roblox camera and no camera manipulation. That second part does not work. The issue is that when I join a team my camera is not following the player- I cant even see the player on the screen. Here are the scripts
-- Camera local TeamChoose = script.Parent.Parent local confirm = script.Parent.Parent.Teamchange.Frame.Light.Button --Select button local confirm2 = script.Parent.Parent.Teamchange.Frame.Dark.TextButton --Select button local Camera = game.Workspace.CurrentCamera local Player = game.Players.LocalPlayer repeat wait() until Player.Character Camera.CameraType = "Scriptable" Camera.CFrame = game.Workspace.CamPart.CFrame confirm.MouseButton1Click:Connect(function() Camera.CameraType = "Custom" game.Workspace.CamPart:Destroy() end) confirm2.MouseButton1Click:Connect(function() Camera.CameraType = "Custom" game.Workspace.CamPart:Destroy() end)
And the team change (there are two of these, one for each team)
local Camera = game.Workspace.CurrentCamera local Player = game.Players.LocalPlayer local player = script.Parent.Parent.Parent.Parent.Parent local TeamChoose = script.Parent.Parent local confirm = script.Parent.Button local confirm2 = script.Parent.Parent.Dark.TextButton script.Parent.MouseButton1Click:Connect(function() script.Parent.Button.Visible = false script.Parent.Parent.Light.Button.Visible = true end) script.Parent.Button.MouseButton1Click:Connect(function() player.Team = game.Teams.Light TeamChoose:TweenPosition(UDim2.new(0.25, -0,-1, -0),"Out","Quint",1,true) player.Character.Humanoid.Health = 0 end)
Thanks in advance
in addition to what @torchmaster101 said, you also need to change the camera subject back to the player's humanoid, because by default the camera subject for a game is the player's humanoid, so add this instead of deleting the part,
confirm.MouseButton1Click:Connect(function() Camera.CameraSubject = player.Character:WaitForChild("Humanoid") end) confirm2.MouseButton1Click:Connect(function() Camera.CameraSubject = player.Character.Humanoid end)
So, my personal advice with changing a camera type is to not just type in something like:
Camera.CameraType = "Scriptable"
But instead something like:
repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable
Camera Types are an Enumeration, so I recommend typing it like this instead of typing it as a string and in one line.
Also, line 9 of the first script confuses me. Are you trying to get the character? If you are, you can just do something like:
local character = player.Character or player.CharacterAdded:Wait()
Comment back if this doesn't fix your problem or you have any questions.
local TeamChoose = script.Parent.Parent local confirm = script.Parent.Parent.Teamchange.Frame.Light.Button local confirm2 = script.Parent.Parent.Teamchange.Frame.Dark.TextButton local Camera = game.Workspace.CurrentCamera local Player = game.Players.LocalPlayer repeat wait() until Player.Character repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = game.Workspace.CamPart.CFrame confirm.MouseButton1Click:Connect(function() Camera.CameraSubject = Player.Character:WaitForChild("Humanoid") end) confirm2.MouseButton1Click:Connect(function() Camera.CameraSubject = Player.Character.Humanoid end)