The issue I found when testing this was that you created a local variable which directed to a property of an instance, not only that you you are changing the Frame in the StarterGui and not the PlayerGui.
you wrote
local fade = game.StarterGui.ScreenGui.Frame.BackgroundTransparency
humanoid.Died:Connect(function()
fade = 0
end)
instead it should be:
local fade = player:WaitForChild("PlayerGui").ScreenGui.Frame.BackgroundTransparency
humanoid.Died:Connect(function()
fade.BackgroundTransparency = 0
end)
By the way, you also misspelled Character in local char = player.Charcter
so this should work
wait(1)
local player = game.Players.LocalPlayer
local char = player.Character
local humanoid = char.Humanoid
local fade = player:WaitForChild("PlayerGui").ScreenGui.Frame.BackgroundTransparency
humanoid.Died:Connect(function()
fade.BackgroundTransparency = 0
end)
4 comments
You might want to wait for the Character.
Also when updating a Gui you always want to update the PlayerGui instead of the StarterGui by fade = player.PlayerGui.ScreenGui.Frame.BackgroundTransparency
also, learn the difference between references and values
id recommend what songboy50 is saying, try to put the local script in starter gui, it will make things easier, and remember a local script is always the descendant of a player