#Why my camera dont change to custom

1 messages · Page 1 of 1 (latest)

swift charm
#

I made script to char selection but when I click button my camera dont change to custom and my character after die dont change into selected char here is script of char selection:local plr = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local selectedChar = nil

if not selectedChar then
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.CameraPart.CFrame
end

script.Parent.CharacterSelection.Visible = true

for _, CharButton in ipairs(script.Parent.CharacterSelection:GetDescendants()) do
if CharButton:IsA("TextButton") and CharButton:HasTag("CharSelection") then
local isClicked = false
CharButton.MouseButton1Click:Connect(function()
if isClicked then return end

        isClicked = true
        
        selectedChar = CharButton.Name
        
        script.Parent.CharacterSelection.Visible = true
        
        game.ReplicatedStorage.Events.CharSelect:FireServer(CharButton.Name)
        camera.CameraType = Enum.CameraType.Custom
        
        plr.CharacterAdded:Wait()
        camera.CameraSubject = plr.Character:WaitForChild("HumanoidRootPart")
    end)
end

end

game.Players.LocalPlayer.CharacterAdded:Connect(function()
if not selectedChar then return end
camera.CameraType = Enum.CameraType.Custom
game.ReplicatedStorage.Events.CharSelect:FireServer(selectedChar)
end)

limpid shuttle
#

selectedChar resets to nil after respawn
you're setting selectedChar locally when the player dies and respawns, the localScript resets, and selectedChar becomes nil again — this breaks your respawn logic (im not sure its the problem)

swift charm
#

so how to repair it

brisk grove