When a player dies in game, the script no longer works. Before the player dies everything seems fine but when they die, it wont work. There's no output either. I looked through my script and found nothing. Someone help.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local remote = game.ReplicatedStorage.TeleRemote local remoted = game.ReplicatedStorage.TeleRemoteD local mtarget local mtarget2 local down local partic local f4 local attach0 local attach1 beam = game.ReplicatedStorage.TeleBeam local cool = true game.StarterPack.LocalScript.Value.Name = player.Name mouse.Button2Down :connect(function() --if game.ReplicatedStorage.Mana.Value < 20 then return end if cool == true then remote:FireServer() mtarget2 = game.Workspace.Tele attach0 = mtarget2.TeleAttachment attach1 = player.Character.RightHand.RightGripAttachment down = true mtarget2.ParticleEmitter.Enabled = true beam.Attachment0 = attach0 beam.Attachment1 = attach1 beam.Parent = attach1.Parent end end) mouse.Move:Connect(function() if down == true then local posX,posY,posZ = mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z mtarget2.CFrame = CFrame.new(posX,posY,posZ) end end) mouse.Button2Up:connect(function() if cool == true then if down == true then game.ReplicatedStorage.Mana.Value = game.ReplicatedStorage.Mana.Value - 0 cool = false remoted:FireServer() f4 = game.ReplicatedStorage.ParticleEmitter2:Clone() mtarget = player.Character.HumanoidRootPart local posX,posY,posZ = mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z mtarget.CFrame = CFrame.new(posX,posY,posZ) + Vector3.new(0,3,0) down = false mtarget2.ParticleEmitter.Enabled = false beam.Parent = game.ReplicatedStorage cool = true end end end)