Basically when the character dies, i need the screen to of faded into a black, so when the player dies, it doesnt do that, only in studio it works this is the local script:
game.Players.PlayerAdded:Connect(function(player)
while true do
player.Character.Humanoid.Died:Connect(function()
script.Parent.RemoteEvent:FireServer()
end)
end
end)
so it fires the remote event. this is the script
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
game.ReplicatedStorage.Scripts:Clone().Parent = game.StarterGui
game.ReplicatedStorage.ScreenGui:Clone().Parent = game.StarterGui
local Screen = Instance.new("ScreenGui", script.Parent.Parent)
local Fade = Instance.new("Frame", Screen)
local nope = 0
Screen.Enabled = true
Fade.Size = UDim2.new(1,0,1,0)
Fade.BackgroundColor3 = Color3.fromRGB(0,0,0)
Fade.BackgroundTransparency = 2
game.Players.LocalPlayer:WaitForChild("PlayerGui"):SetTopbarTransparency(0)
repeat
Fade.BackgroundTransparency = Fade.BackgroundTransparency - .1
nope = nope + 1
wait(.01)
until nope == 200
nope = 0
end)
fade.Backgroundtransparency is 2 just to give more of a delay, but i have noo idea why it is only working in studio

1 comment
you cant use playeradded on local scripts and the max for BackgroundTransparency is 1 and the parent argument of Instance.new is decaperated and you can use a for loop to make the frame fade in and more