I have this part that creates itself and names itself after the player who joined the game, but when the camera script tries to set the camera to it, it says it cant find it even though it says the name of the object its trying to find except the object is in the workspace.
function Joined(Player)
x = Instance.new("Part")
x.Shape = "Ball"
x.Parent = game.Workspace
x.Name = Player.Name .. "'s Ball"
x.Material = "Neon"
x.Color = Color3.new(math.random(), math.random(), math.random())
x.Position = workspace.Start.Position
x.CanCollide = true
x.Anchored = false
x.Size = Vector3.new(1, 1, 1)
end
game.Players.PlayerAdded:connect(Joined)
wait(1)
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local playername = Player.Name .. "'s Ball"
print(playername)
wait(1)
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace(playername).CFrame
