Maybe I am just missing something very simple, but unless i remove everything and only keep the plr variable and the CharacterAdded function with the print statement, the CharacterAdded function does not fire
Local Script inside StarterPlayerScripts
local plr = game.Players.LocalPlayer
local deadGui = plr.PlayerGui:WaitForChild("DeadGUI")
local background = deadGui:WaitForChild("Background")
local deadText = background:WaitForChild("DeadText")
local reboot = background:WaitForChild("Reboot")
local txt = reboot.TextLabel
local TS = game:GetService("TweenService")
local TSinfo = TweenInfo.new(0.6,Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
local flatline = background.DeathFlatline
local boom = background.DeathBoom
local camera = game.Workspace.CurrentCamera
print("hi")
plr.CharacterAdded:Connect(function(char)
print("spawned")
local Humanoid = char:WaitForChild("Humanoid")
boom:Stop()
flatline:Stop()
camera.CameraType = Enum.CameraType.Custom
background.Visible = false
Humanoid.Died:Connect(function()
print("dead")
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(1000,1000,1000)
boom:Play()
flatline:Play()
background.Visible = true
flashtext()
deadText:TweenSize(UDim2.new(1, 0,0.4, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.6)
task.wait(2)
TS:Create(txt,TSinfo,{TextTransparency = 0})
TS:Create(txt.Glow,TSinfo,{ImageTransparency = 0.8})
dotdotdot()
end)
end)
I wont include the functions since them being included in the script and not does not affect it at all
try checking the character : Player.Character if its loaded bcuz it does not fire once the character is loaded already so you will need to separate that function
as i said the characteradded doesnt fire once the character is loaded so you will need to check if the character is already loaded to run the function
local plr = game.Players.LocalPlayer
local deadGui = plr.PlayerGui:WaitForChild("DeadGUI")
local background = deadGui:WaitForChild("Background")
local deadText = background:WaitForChild("DeadText")
local reboot = background:WaitForChild("Reboot")
local txt = reboot.TextLabel
local TS = game:GetService("TweenService")
local TSinfo = TweenInfo.new(0.6,Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
local flatline = background.DeathFlatline
local boom = background.DeathBoom
local camera = game.Workspace.CurrentCamera
print("hi")
local function OnCharacterAdded(Character)
print("spawned")
local Humanoid = char:WaitForChild("Humanoid")
boom:Stop()
flatline:Stop()
camera.CameraType = Enum.CameraType.Custom
background.Visible = false
Humanoid.Died:Connect(function()
print("dead")
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(1000,1000,1000)
boom:Play()
flatline:Play()
background.Visible = true
flashtext()
deadText:TweenSize(UDim2.new(1, 0,0.4, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.6)
task.wait(2)
TS:Create(txt,TSinfo,{TextTransparency = 0})
TS:Create(txt.Glow,TSinfo,{ImageTransparency = 0.8})
dotdotdot()
end)
end
plr.CharacterAdded:Connect(OnCharacterAdded)
if plr.Character then
OnCharacterAdded(plr.Character)
end
I think I know your issue, the character loads in before the function is connected. Possibly because of the WaitForChild Stuff that is above the code. Maybe try this?
local plr = game.Players.LocalPlayer
plr.CharacterAdded:Connect(function(char)
print("spawned")
local deadGui = plr.PlayerGui:WaitForChild("DeadGUI")
local background = deadGui:WaitForChild("Background")
local deadText = background:WaitForChild("DeadText")
local reboot = background:WaitForChild("Reboot")
local txt = reboot.TextLabel
local TS = game:GetService("TweenService")
local TSinfo = TweenInfo.new(0.6,Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
local flatline = background.DeathFlatline
local boom = background.DeathBoom
local camera = game.Workspace.CurrentCamera
local Humanoid = char:WaitForChild("Humanoid")
boom:Stop()
flatline:Stop()
camera.CameraType = Enum.CameraType.Custom
background.Visible = false
Humanoid.Died:Connect(function()
print("dead")
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(1000,1000,1000)
boom:Play()
flatline:Play()
background.Visible = true
flashtext()
deadText:TweenSize(UDim2.new(1, 0,0.4, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.6)
task.wait(2)
TS:Create(txt,TSinfo,{TextTransparency = 0})
TS:Create(txt.Glow,TSinfo,{ImageTransparency = 0.8})
dotdotdot()
end)
end)