I’ve been trying to fix this index nil error for the past 14 minutes, still can’t fix it though, I even tried to find solutions from other threads but that did not help either…
Any help is appreciated!
The script:
(It’s also located in StarterPlayerScripts)
local player = game.Players.LocalPlayer
local char = player.Character
local h = char:WaitForChild("Humanoid")
local humanoid = char:FindFirstChild(h)
local info = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local tween = game:GetService("TweenService"):Create(player["Death Message"], info,{BackgroundTransparency = 0})
local deathmessagelist = {"Me personally, i would not let that slide..", "Damn", "Did you know you that you have rights?", "jamesderrman would not like that..", "Kur would be proud!", player.Name..", Honestly you suck", "I am sort of a more mean guiding light!"}
if humanoid then
humanoid.Died:Connect(function()
local gui = player.PlayerGui["Death Screen"]
gui.Enabled = true
gui.Frame.TextLabel.Text = deathmessagelist[math.random(1, #deathmessagelist)]
tween:Play()
tween.Completed:Connect(function()
gui.Frame.TextLabel.Visible = true
end)
wait(9)
gui.Frame.TextLabel = "[insert death message here]"
gui.Frame.BackgroundTransparency = 1
end)
end
The error: