I have this script;
local TeleportService = game:GetService("TeleportService") local gameID = 2094965912 local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local fade = game.StarterGui.ScreenGui.Frame char:WaitForChild("Humanoid").Died:Connect(function() for i=1,10 do fade.BackgroundTransparency = fade.BackgroundTransparency-0.1 wait(0.01) end wait(10) TeleportService:Teleport(gameID) end)
This is a local script located inside of ReplicatedFirst. What is is supposed to accomplish is wait for the local player Humanoid to die, then it will make a black screen fade in and after 10 seconds teleport the local player to another game. For some reason, nothing is happening. At all. Won't even fade, and the console is giving me nothing. Can anyone help?
First things first, let's restart.
- Add a
Script
toStarterCharacterScripts
inStarterPlayer
.- Start listing what you need in terms of variables
local Players = game:GetService('Players') local TeleportService = game:GetService('TeleportService') local PlaceId = 2094965912 local Character = script.Parent -- this is because the script will be duplicated into the Character when the game runs local Player = Players:GetPlayerFromCharacter(Character) local PlayerGui = Player:WaitForChild('PlayerGui') local Humanoid = Character.Humanoid local Fade = PlayerGui.ScreenGui.Frame
- Now List your events
local Players = game:GetService('Players') local TeleportService = game:GetService('TeleportService') local PlaceId = 2094965912 local Character = script.Parent -- this is because the script will be duplicated into the Character when the game runs local Player = Players:GetPlayerFromCharacter(Character) local PlayerGui = Player:WaitForChild('PlayerGui') local Humanoid = Character.Humanoid local Fade = PlayerGui.ScreenGui.Frame Humanoid.Died:Connect(function() end)
- Now finish it with the commanding code
local Players = game:GetService('Players') local TeleportService = game:GetService('TeleportService') local PlaceId = 2094965912 local Character = script.Parent -- this is because the script will be duplicated into the Character when the game runs local Player = Players:GetPlayerFromCharacter(Character) local PlayerGui = Player:WaitForChild('PlayerGui') local Humanoid = Character.Humanoid local Fade = PlayerGui.ScreenGui.Frame Humanoid.Died:Connect(function() for i = 1, 10 do wait() Fade.BackgroundTransparency = Fade.BackgroundTransparency - 0.1 end wait(10) TeleportService:Teleport(PlaceId, Player) -- This line might need changing end)
The thing about this script is each time you die it will be automatically reset.
Note: Copy pasting the code may not work. This is because I'm typing this raw with no tests. Simply do the work yourself.
Hope this helped!
Best of luck developer!
BlackOrange3343