So I'm making a script that basically when you die your screen fades to black and you get teleported. I made a localscript for this and it worked, however, all it is doing is teleporting. How could I fix this?
local TeleportService = game:GetService("TeleportService") local gameID = 2094965912 local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() character:WaitForChild("Humanoid").Died:Connect(function() game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 1 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.9 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.8 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.7 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.6 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.5 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.4 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.3 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.2 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0.1 wait(0.1) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0 TeleportService:Teleport(gameID) end)
This is due to the fact you are editing the Starter Gui rather than the GUI that the player actually has. After looking, the script provided below should work, if not feel free to contact me.
local TeleportService = game:GetService("TeleportService") local gameID = 2094965912 local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() character:WaitForChild("Humanoid").Died:Connect(function() player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 1 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.9 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.8 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.7 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.6 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.5 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.4 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.3 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.2 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0.1 wait(0.1) player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0 TeleportService:Teleport(gameID) end)