local Players = game:GetService("Players") local localPlayer = Players.LocalPlayer local StarterGui = game:GetService("StarterGui") -- Função para mostrar a mensagem de ativação local function showActivationMessage() local screenGui = Instance.new("ScreenGui") screenGui.Name = "ActivationMessageGui" local textLabel = Instance.new("TextLabel") textLabel.Name = "ActivationMessage" textLabel.Size = UDim2.new(0, 300, 0, 50) textLabel.Position = UDim2.new(1, -310, 0, 10) -- Canto superior direito textLabel.Text = "o script de invencibilidade foi ativado" textLabel.TextColor3 = Color3.new(1, 1, 1) -- Branco textLabel.TextScaled = true textLabel.BackgroundTransparency = 1 textLabel.Font = Enum.Font.SourceSans textLabel.Parent = screenGui screenGui.Parent = StarterGui -- Espera 3 segundos e remove a mensagem wait(3) screenGui:Destroy() end -- Chama a função da mensagem showActivationMessage() -- Conecta a uma função toda vez que o seu personagem é adicionado ao jogo localPlayer.CharacterAdded:Connect(function(character) local humanoid = character:WaitForChild("Humanoid") local humanoidRootPart = character:WaitForChild("HumanoidRootPart") local deathPosition = Vector3.new(0, 0, 0) -- Detecta a morte do personagem humanoid.Died:Connect(function() -- Salva a posição exata onde o personagem morreu deathPosition = humanoidRootPart.Position -- Carrega o personagem novamente (força o renascimento) localPlayer:LoadCharacter() end) -- Conecta a uma função toda vez que o personagem é regenerado localPlayer.CharacterAdded:Connect(function(newCharacter) -- Aguarda um momento para que o novo personagem seja carregado wait() -- Teletransporta o novo personagem para a posição da morte newCharacter:SetPrimaryPartCFrame(CFrame.new(deathPosition)) end) end)