bang bang gui
Key Required

bang bang gui

[🎂] Dress To Impressniconeiasadfniconeiasadf 12.1K views 536 executesUpdated Jun 14, 2025
Unrated
00
Lua Script•493 lines (14312 chars)
--[[
	Bang Bang UI - Versão Corrigida
	Corrigido problemas de morte e melhorada estabilidade
]]

-- Instances:
local ScreenGui = Instance.new("ScreenGui")
local Frame = Instance.new("Frame")
local UICorner = Instance.new("UICorner")
local TextBox = Instance.new("TextBox")
local UICorner_2 = Instance.new("UICorner")
local TextLabel = Instance.new("TextLabel")
local TextButton = Instance.new("TextButton")
local UICorner_3 = Instance.new("UICorner")
local StopButton = Instance.new("TextButton")
local UICorner_4 = Instance.new("UICorner")
local SpeedButton = Instance.new("TextButton")
local UICorner_5 = Instance.new("UICorner")

--Properties:
ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.ResetOnSpawn = false

Frame.Parent = ScreenGui
Frame.BackgroundColor3 = Color3.fromRGB(48, 48, 48)
Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
Frame.BorderSizePixel = 0
Frame.Position = UDim2.new(0.0693131685, 0, 0.563703477, 0)
Frame.Size = UDim2.new(0, 187, 0, 260)

UICorner.CornerRadius = UDim.new(0, 15)
UICorner.Parent = Frame

TextBox.Parent = Frame
TextBox.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
TextBox.BorderColor3 = Color3.fromRGB(0, 0, 0)
TextBox.BorderSizePixel = 0
TextBox.Position = UDim2.new(0.0850661993, 0, 0.232432127, 0)
TextBox.Size = UDim2.new(0, 155, 0, 34)
TextBox.Font = Enum.Font.SourceSans
TextBox.Text = ""
TextBox.TextColor3 = Color3.fromRGB(177, 177, 177)
TextBox.TextScaled = true
TextBox.TextSize = 14.000
TextBox.TextWrapped = true
TextBox.PlaceholderText = "Digite o nome do jogador"

UICorner_2.CornerRadius = UDim.new(0, 15)
UICorner_2.Parent = TextBox

TextLabel.Parent = Frame
TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextLabel.BackgroundTransparency = 1.000
TextLabel.BorderColor3 = Color3.fromRGB(0, 0, 0)
TextLabel.BorderSizePixel = 0
TextLabel.Position = UDim2.new(0.024335403, 0, -0.00244565867, 0)
TextLabel.Size = UDim2.new(0, 177, 0, 32)
TextLabel.Font = Enum.Font.SourceSans
TextLabel.Text = "Bang Bang UI - Fixed"
TextLabel.TextColor3 = Color3.fromRGB(170, 170, 170)
TextLabel.TextScaled = true
TextLabel.TextSize = 14.000
TextLabel.TextWrapped = true

TextButton.Parent = Frame
TextButton.BackgroundColor3 = Color3.fromRGB(88, 88, 88)
TextButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
TextButton.BorderSizePixel = 0
TextButton.Position = UDim2.new(0.133194536, 0, 0.52, 0)
TextButton.Size = UDim2.new(0, 136, 0, 35)
TextButton.Font = Enum.Font.SourceSans
TextButton.Text = "Bang Bang"
TextButton.TextColor3 = Color3.fromRGB(202, 202, 202)
TextButton.TextScaled = true
TextButton.TextSize = 14.000
TextButton.TextWrapped = true

UICorner_3.Parent = TextButton

StopButton.Parent = Frame
StopButton.BackgroundColor3 = Color3.fromRGB(150, 50, 50)
StopButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
StopButton.BorderSizePixel = 0
StopButton.Position = UDim2.new(0.133194536, 0, 0.65, 0)
StopButton.Size = UDim2.new(0, 136, 0, 30)
StopButton.Font = Enum.Font.SourceSans
StopButton.Text = "STOP"
StopButton.TextColor3 = Color3.fromRGB(255, 255, 255)
StopButton.TextScaled = true
StopButton.TextSize = 14.000
StopButton.TextWrapped = true

UICorner_4.Parent = StopButton

SpeedButton.Parent = Frame
SpeedButton.BackgroundColor3 = Color3.fromRGB(50, 150, 50)
SpeedButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
SpeedButton.BorderSizePixel = 0
SpeedButton.Position = UDim2.new(0.133194536, 0, 0.80, 0)
SpeedButton.Size = UDim2.new(0, 136, 0, 30)
SpeedButton.Font = Enum.Font.SourceSans
SpeedButton.Text = "Speed: Normal"
SpeedButton.TextColor3 = Color3.fromRGB(255, 255, 255)
SpeedButton.TextScaled = true
SpeedButton.TextSize = 14.000
SpeedButton.TextWrapped = true

UICorner_5.Parent = SpeedButton

-- Scripts:
local function MAIN_SCRIPT()
	local players = game:GetService("Players")
	local runservice = game:GetService("RunService")
	local tweenService = game:GetService("TweenService")
	
	local bang = false
	local target = ""
	local admin = players.LocalPlayer
	local inout = false
	local cam = workspace.Camera
	local originalJumpPower = 50
	local noclipEnabled = false
	local noclipConnections = {}
	local bangSpeed = 1
	local speedNames = {"Normal", "Rápido", "Muito Rápido"}
	local bangTimes = {
		{inTime = 0.3, outTime = 0.25},   -- Normal (mais lento para evitar bugs)
		{inTime = 0.2, outTime = 0.15},   -- Rápido  
		{inTime = 0.1, outTime = 0.08}    -- Muito Rápido
	}
	
	-- Variáveis para auto-retorno controlado
	local originalHealth = 100
	local healthConnection = nil
	local deathConnection = nil
	local autoReturn = false -- Para controlar auto-retorno
	local hasReturned = false -- Para garantir que só retorna uma vez
	
	-- Função para detectar morte e preparar auto-retorno
	local function protectFromDeath()
		if admin.Character and admin.Character:FindFirstChild("Humanoid") then
			local humanoid = admin.Character.Humanoid
			originalHealth = humanoid.MaxHealth
			
			-- Conectar para detectar morte (não prevenir)
			if deathConnection then
				deathConnection:Disconnect()
			end
			
			deathConnection = humanoid.Died:Connect(function()
				if bang and not hasReturned then
					autoReturn = true
					hasReturned = true -- Marcar que já foi ativado
					print("Morte detectada! Auto-retorno será ativado quando regenerar...")
				end
			end)
		end
	end
	
	-- Função para ativar/desativar noclip MELHORADA
	local function toggleNoclip(enable)
		noclipEnabled = enable
		
		-- Limpar conexões antigas
		for _, connection in pairs(noclipConnections) do
			if connection then
				connection:Disconnect()
			end
		end
		noclipConnections = {}
		
		if enable and admin.Character then
			-- Função noclip mais estável
			local function noclip()
				if admin.Character then
					for _, part in pairs(admin.Character:GetChildren()) do
						if part:IsA("BasePart") and part.CanCollide then
							part.CanCollide = false
						end
					end
				end
			end
			
			-- Conectar ao RenderStepped para melhor performance
			noclipConnections[1] = runservice.RenderStepped:Connect(noclip)
			
			-- Conectar quando partes são adicionadas
			if admin.Character then
				noclipConnections[2] = admin.Character.ChildAdded:Connect(function(child)
					if child:IsA("BasePart") then
						child.CanCollide = false
					end
				end)
			end
			
			print("Noclip ativado!")
		else
			-- Desativar noclip de forma segura
			if admin.Character then
				for _, part in pairs(admin.Character:GetChildren()) do
					if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
						part.CanCollide = true
					end
				end
			end
			print("Noclip desativado!")
		end
	end
	
	-- Função para parar o bang (reseta auto-retorno)
	local function stopBang()
		bang = false
		autoReturn = false -- Desativar auto-retorno
		hasReturned = false -- Resetar contador de retorno
		
		if admin.Character and admin.Character:FindFirstChild("Humanoid") then
			local humanoid = admin.Character.Humanoid
			local rootPart = admin.Character:FindFirstChild("HumanoidRootPart")
			
			-- Restaurar propriedades
			humanoid.Sit = false
			humanoid.PlatformStand = false
			
			if rootPart then
				rootPart.Anchored = false
				-- Mover para uma posição segura
				rootPart.CFrame = rootPart.CFrame + Vector3.new(0, 5, 0)
			end
			
			-- Restaurar câmera
			cam.CameraSubject = admin.Character:FindFirstChild("Humanoid")
			
			-- Restaurar jump power
			humanoid.JumpPower = originalJumpPower
			
			target = ""
			
			-- Desativar noclip
			toggleNoclip(false)
			
			-- Desconectar proteções
			if healthConnection then
				healthConnection:Disconnect()
				healthConnection = nil
			end
			
			if deathConnection then
				deathConnection:Disconnect()
				deathConnection = nil
			end
			
			print("Bang parado!")
		end
	end
	
	-- Aguardar character regenerar completamente para auto-retorno
	admin.CharacterAdded:Connect(function(character)
		character:WaitForChild("HumanoidRootPart")
		character:WaitForChild("Humanoid")
		
		-- Aguardar regeneração completa
		wait(3)
		
		if character:FindFirstChild("Humanoid") then
			originalJumpPower = character.Humanoid.JumpPower
			originalHealth = character.Humanoid.MaxHealth
		end
		
		-- AUTO-RETORNO: Só quando regenerar completamente
		if autoReturn and target ~= "" and players:FindFirstChild(target) then
			local targetPlayer = players[target]
			if targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
				print("Personagem regenerado! Executando auto-retorno...")
				
				-- Aguardar mais um pouco para garantir que está tudo ok
				wait(1)
				
				-- Reconfigurar bang
				bang = true
				local humanoid = character.Humanoid
				
				-- Sentar e configurar
				humanoid.Sit = true
				humanoid.JumpPower = 0
				
				-- Configurar câmera
				cam.CameraSubject = targetPlayer.Character.HumanoidRootPart
				
				-- Reativar proteções
				protectFromDeath()
				
				-- Reativar noclip
				toggleNoclip(true)
				
				print("Auto-retorno concluído! Bang reiniciado.")
				print("AVISO: Auto-retorno só funcionará mais uma vez se morrer novamente.")
			else
				print("Auto-retorno cancelado: alvo não encontrado.")
				autoReturn = false
				hasReturned = false
			end
		else
			-- Se estava com noclip ativo, reativar
			if noclipEnabled then
				toggleNoclip(true)
			end
		end
	end)
	
	-- Botão principal MELHORADO
	TextButton.MouseButton1Click:Connect(function()
		local namefrags = TextBox.Text:lower()
		
		-- Verificar se quer parar
		if namefrags == "me" or namefrags == "stop" or namefrags == "" then
			stopBang()
			return
		end
		
		-- Verificar se o personagem existe
		if not admin.Character or not admin.Character:FindFirstChild("HumanoidRootPart") then
			print("Aguarde seu personagem carregar!")
			return
		end
		
		-- Procurar jogador
		local allplr = players:GetPlayers()
		local found = false
		
		for _, plr in pairs(allplr) do
			local plrname = plr.Name:lower()
			
			if plrname:find(namefrags) or plrname:sub(1, #namefrags) == namefrags then
				if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") and plr ~= admin then
					print("Jogador encontrado: " .. plr.Name)
					
					local humanoid = admin.Character:FindFirstChild("Humanoid")
					if humanoid then
						-- Preparar para bang
						bang = true
						target = plr.Name
						
						-- Configurar personagem
						humanoid.Sit = true
						humanoid.JumpPower = 0
						
						-- Configurar câmera
						cam.CameraSubject = plr.Character.HumanoidRootPart
						
						-- Reativar proteções para próxima morte
						protectFromDeath()
						
						-- Reativar noclip
						toggleNoclip(true)
						
						found = true
						hasReturned = false -- Resetar para permitir novo auto-retorno
						break
					end
				end
			end
		end
		
		if not found then
			print("Jogador não encontrado: " .. namefrags)
		end
	end)
	
	-- Botão de parar (reseta auto-retorno)
	StopButton.MouseButton1Click:Connect(function()
		autoReturn = false -- Desativar auto-retorno
		hasReturned = false -- Resetar contador
		stopBang()
		print("Auto-retorno resetado.")
	end)
	
	-- Botão de velocidade
	SpeedButton.MouseButton1Click:Connect(function()
		bangSpeed = bangSpeed + 1
		if bangSpeed > 3 then
			bangSpeed = 1
		end
		SpeedButton.Text = "Speed: " .. speedNames[bangSpeed]
		print("Velocidade: " .. speedNames[bangSpeed])
	end)
	
	-- Coroutine para controlar timing
	local co = coroutine.create(function()
		while true do
			if bang then
				local currentSpeed = bangTimes[bangSpeed]
				inout = true
				wait(currentSpeed.inTime)
				inout = false
				wait(currentSpeed.outTime)
			else
				wait(0.1)
			end
		end
	end)
	
	coroutine.resume(co)
	
	-- Loop principal MELHORADO
	spawn(function()
		while true do
			if bang and target ~= "" and players:FindFirstChild(target) then
				local targetPlayer = players[target]
				
				if targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") 
				and admin.Character and admin.Character:FindFirstChild("HumanoidRootPart") then
					
					local targetRoot = targetPlayer.Character.HumanoidRootPart
					local adminRoot = admin.Character.HumanoidRootPart
					
					-- Posição original do script
					if inout then
						adminRoot.CFrame = targetRoot.CFrame * CFrame.new(0, -1, -2.1) * CFrame.Angles(math.rad(-90), 0, 0)
					else
						adminRoot.CFrame = targetRoot.CFrame * CFrame.new(0, -1, -3) * CFrame.Angles(math.rad(-90), 0, 0)
					end
					
					-- Manter saúde
					if admin.Character:FindFirstChild("Humanoid") then
						local humanoid = admin.Character.Humanoid
						if humanoid.Health < originalHealth * 0.5 then
							humanoid.Health = originalHealth
						end
					end
					
				else
					-- Se o jogador saiu ou resetou, parar
					print("Alvo perdido, parando bang...")
					stopBang()
				end
			end
			
			-- Wait mais estável
			runservice.Heartbeat:Wait()
		end
	end)
	
	-- Função para limpar quando o script é destruído
	ScreenGui.AncestryChanged:Connect(function()
		if not ScreenGui.Parent then
			stopBang()
		end
	end)
end

-- Executar script principal
coroutine.wrap(MAIN_SCRIPT)()

-- Script para tornar a GUI arrastável
local function DRAG_SCRIPT()
	local UserInputService = game:GetService('UserInputService')
	local frame = Frame
	
	local dragging = false
	local dragStart = nil
	local startPos = nil
	
	frame.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			dragging = true
			dragStart = input.Position
			startPos = frame.Position
		end
	end)
	
	frame.InputChanged:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
			local delta = input.Position - dragStart
			frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
		end
	end)
	
	UserInputService.InputEnded:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			dragging = false
		end
	end)
end

coroutine.wrap(DRAG_SCRIPT)()

print("Bang Bang UI com Auto-Retorno Controlado carregado!")
print("Funcionamento:")
print("- Só retorna quando REGENERAR completamente")
print("- Não interfere quando corpo fica em pedaços")
print("- Auto-retorno acontece apenas UMA VEZ por morte")
print("- Use STOP para resetar o auto-retorno")

Features & Information

kkkkkkkkkkkkkkk

Community Comments (0)

No comments yet for this script.

More Scripts for [🎂] Dress To Impress