My menu is not changing back to the player’s camera when I have coded it to.
- There is a script in StarterPlayer that is changing the camera to scriptable, one time, and there is a Menu Mouse / Camera Movement code that doesn’t really affect it and when manually I delete the camera and then change it to Custom, and subject to Humanoid it works.
Code:
local TweenService = game:GetService("TweenService")
local Team = game:GetService("Teams")
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local tweenInfo2 = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local PlayButton = script.Parent
local TeamUI = script.Parent.Parent.TeamSelectFrame
local TeamD = TeamUI.TeamD
local TeamSECURE = TeamUI.TeamSECURE
local TeamScientist = TeamUI.TeamScientist
local MainFrame = script.Parent.Parent.MainFrame
local Player = game.Players.LocalPlayer
local Players = game:GetService("Players")
local tweenPlayButton = TweenService:Create(PlayButton, tweenInfo, {Position = UDim2.new(0.389, 0, 0.31, 0)})
local tweenTeamFrame1 = TweenService:Create(TeamUI, tweenInfo, {Position = UDim2.new(0.566, 0, 2, 0)})
local tweenMainFrame1 = TweenService:Create(MainFrame, tweenInfo, {Position = UDim2.new(0.103, 0,2, 0)})
local ScientistPart = game.Workspace.ScientistPart
local TestSubjectPart = game.Workspace.TestSubjectPart
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local player = game.Players.LocalPlayer
local Char = player.Character or player.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
TeamSECURE.MouseButton1Click:Connect(function()
tweenPlayButton:Play()
tweenTeamFrame1:Play()
tweenMainFrame1:Play()
for i, v in pairs(Players:GetChildren()) do
if v:IsA("Player") then
v.Team = game.Teams.Security
end
end
end)
TeamD.MouseButton1Click:Connect(function()
tweenPlayButton:Play()
tweenTeamFrame1:Play()
tweenMainFrame1:Play()
for i, v in pairs(Players:GetChildren()) do
if v:IsA("Player") then
v.Team = game.Teams["Test Subject"]
game.Players.LocalPlayer.Character:MoveTo(TestSubjectPart.Position)
end
end
end)
TeamScientist.MouseButton1Click:Connect(function()
tweenPlayButton:Play()
tweenTeamFrame1:Play()
tweenMainFrame1:Play()
for i, v in pairs(Players:GetChildren()) do
if v:IsA("Player") then
v.Team = game.Teams.Scientist
game.Players.LocalPlayer.Character:MoveTo(ScientistPart.Position)
end
end
end)
PlayButton.MouseButton1Click:Connect(function()
PlayButton.Visible = false
repeat wait ()
Camera.CameraType = Enum.CameraType.Custom
until Camera.CameraType == Enum.CameraType.Custom
Camera.CameraSubject = Humanoid
Camera.CameraSubject = Char.Humanoid
Camera.CameraType = "Custom"
Camera.CFrame = Char.Head.CFrame
end)
the camera part is near the end.