First things first, let's restart.
- Add a
Script to StarterCharacterScripts in StarterPlayer.
- 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
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
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
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)
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
2 comments
How is the player getting killed? When I tested this it worked. [local player = game.Players.LocalPlayer; local char = player.Character or player.CharacterAdded:Wait(); char:WaitForChild("Humanoid").Died:Connect(function() print('you died!!1'); end);]
are you sure that its not firing, it might b firing but the code insideit is wrong try adding a print inside and if it printed that means it fired