Hello! I created a team change gui, and basically when you spawn in your camera is at a certain parts CFrame. If a team is chosen, then your player respawns and the camera goes back to your player after it dies. However, when I chose to be on the "Infants" team, the camera goes back to player but it is stuck in position, I found out it works after you reset though. The camera works fine when the "Adults" team is chosen.
The problem has to do with line 79, but I'll post the whole script so there isn't any confusion. Thank you for reading!
local core = script.Parent.Parent.Core
local player = game:GetService('Players').LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local HumanoidRootPart = character:WaitForChild('HumanoidRootPart')
local Camera = game.Workspace.CurrentCamera
local BLUR = game.Lighting.Blur
local RemoteEvent = game.ReplicatedStorage.Remotes.ChangeTeam
local menuButton
local InfantBTN = script.Parent:WaitForChild("Infant"):WaitForChild("Button")
local ParentBTN = script.Parent:WaitForChild("Adult"):WaitForChild("Button")
local GUI = script.Parent
local TweenService = game:GetService("TweenService")
local InfantColor = "Cool yellow"
local ParentColor = "Persimmon"
InfantBTN.MouseButton1Click:Connect(function()
-- Tween the button
local tweenInfo = TweenInfo.new(.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, true, 0)
local goal = {}
goal.Position = (UDim2.new(0.048, 0,0.387, 0))
goal.Size = (UDim2.new(0, 213,0, 165))
local tween = TweenService:Create(InfantBTN, tweenInfo, goal)
tween:Play()
-- Fire the Remote Event
RemoteEvent:FireServer(BrickColor.new(InfantColor))
wait(.5)
GUI.Enabled = false
BLUR.Size = 1.1
Camera.CameraType = "Custom"
Camera.CFrame = HumanoidRootPart.CFrame
core.Enabled = true
end)
ParentBTN.MouseButton1Click:Connect(function()
-- Tween the button
local tweenInfo = TweenInfo.new(.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, true, 0)
local goal = {}
goal.Position = (UDim2.new(0.048, 0,0.387, 0))
goal.Size = (UDim2.new(0, 213,0, 165))
local tween = TweenService:Create(ParentBTN, tweenInfo, goal)
tween:Play()
-- Fire the Remote Event
RemoteEvent:FireServer(BrickColor.new(ParentColor))
wait(.5)
GUI.Enabled = false
BLUR.Size = 1.1
Camera.CameraType = "Custom"
Camera.CFrame = HumanoidRootPart.CFrame
core.Enabled = true
end)

1 comment
Thank you!! :) I will keep this in mind for the future.