Error when the parts of the body of the character disappear

Well, I have a problem in which you fall to the void, you die and your parts of the character’s body disappear, it gives an error and I do not know how to solve it. The error gives me in line 35, I tried with FindFirstChild but it does not work

local Service = game:GetService("RunService")
local Map = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Camera = Instance.new("Camera",Map)
local ArrowScale = 12

local Mouse = Player:GetMouse()
local a = -90

if not Character or not Character.Parent then
Character = Player.CharacterAdded:wait()
end

script.Parent.Arrow.Size = script.Parent.Arrow.Size*ArrowScale
Camera.CameraType = Enum.CameraType.Scriptable
Map.CurrentCamera = Camera
Camera.Name = "Camara"
Camera.CameraType = Enum.CameraType.Scriptable
Camera.FieldOfView = 60

function UpdatePosition()
local DisplayedIconos = Map.Iconos:GetChildren()
for i = 1 ,#DisplayedIconos do

local Location = DisplayedIconos[i].Location.Value

local Vector = Camera:WorldToViewportPoint(Location)

DisplayedIconos[i].Position = UDim2.new(Vector.X,0,Vector.Y,0)
end
end

-- Road Copy ---

local RoadFolder = game.Workspace.Mapayiconos.MinimapObjects:Clone()

RoadFolder.Parent = Map.Mapa

Service.RenderStepped:Connect(function()
if Character then
script.Parent.Arrow.CFrame = CFrame.new(Character.HumanoidRootPart.Position - Vector3.new(0,Character.HumanoidRootPart.Position.Y - 0.5,0))
script.Parent.Arrow.Orientation = Vector3.new(0,Character.HumanoidRootPart.Orientation.y,90)
Camera.CFrame = script.Parent.Arrow.CFrame
Camera.CFrame = script.Parent.Arrow.CFrame:ToWorldSpace(CFrame.new(150,0,250))
Camera.CFrame = CFrame.new(Camera.CFrame.Position,script.Parent.Arrow.Position)
UpdatePosition()
end
end)
1 Like