local ScreenGui = Instance.new("ScreenGui")
local ToggleButton = Instance.new("TextButton")
ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
ToggleButton.Parent = ScreenGui
ToggleButton.Size = UDim2.new(0, 200, 0, 50)
ToggleButton.Position = UDim2.new(0, 10, 0, 10) -- Spawns in the top-left corner
ToggleButton.Text = "Kill All: OFF"
ToggleButton.BackgroundColor3 = Color3.new(1, 0, 0)
ScreenGui.ResetOnSpawn = false -- Prevent GUI from resetting on respawn
local UIS = game:GetService("UserInputService")
local Dragging = false
local DragStart, StartPos
ToggleButton.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
Dragging = true
DragStart = input.Position
StartPos = ToggleButton.Position
end
end)
ToggleButton.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
Dragging = false
end
end)
UIS.InputChanged:Connect(function(input)
if Dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
local Delta = input.Position - DragStart
ToggleButton.Position = UDim2.new(
StartPos.X.Scale,
StartPos.X.Offset + Delta.X,
StartPos.Y.Scale,
StartPos.Y.Offset + Delta.Y
)
end
end)
local killall = false
ToggleButton.MouseButton1Click:Connect(function()
killall = not killall
if killall then
ToggleButton.Text = "Kill All: ON"
ToggleButton.BackgroundColor3 = Color3.new(0, 1, 0)
while killall do
for _, player in ipairs(game.Players:GetPlayers()) do
if player ~= game.Players.LocalPlayer then
local args = {
[1] = player,
[2] = 16000
}
game.ReplicatedStorage.PlayerHitEvent:FireServer(unpack(args))
task.wait(1)
end
end
end
else
ToggleButton.Text = "Kill All: OFF"
ToggleButton.BackgroundColor3 = Color3.new(1, 0, 0)
end
end)
Comments
No comments yet
Be the first to share your thoughts!