
Keyless

-- UI Setup
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
local runService = game:GetService("RunService")
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "SlashToggleUI"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")
-- Create the toggle button
local toggleButton = Instance.new("TextButton")
toggleButton.Size = UDim2.new(0, 180, 0, 50)
toggleButton.Position = UDim2.new(0.05, 0, 0.3, 0)
toggleButton.Text = "Toggle Slash (OFF)"
toggleButton.BackgroundColor3 = Color3.fromRGB(255, 60, 60)
toggleButton.TextColor3 = Color3.new(1, 1, 1)
toggleButton.Font = Enum.Font.GothamBold
toggleButton.TextScaled = true
toggleButton.Parent = screenGui
toggleButton.Active = true
toggleButton.Draggable = true
-- Rounded corners
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 12)
corner.Parent = toggleButton
-- Glow effect
local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(255, 255, 255)
stroke.Thickness = 2
stroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
stroke.Transparency = 0.5
stroke.Parent = toggleButton
-- Toggle logic
local toggled = false
-- Hover animation
local tweenService = game:GetService("TweenService")
local function hover(on)
local goal = {}
if on then
goal.BackgroundColor3 = Color3.fromRGB(255, 90, 90)
else
goal.BackgroundColor3 = toggled and Color3.fromRGB(60, 200, 60) or Color3.fromRGB(255, 60, 60)
end
local tween = tweenService:Create(toggleButton, TweenInfo.new(0.2), goal)
tween:Play()
end
toggleButton.MouseEnter:Connect(function() hover(true) end)
toggleButton.MouseLeave:Connect(function() hover(false) end)
-- Function to fire remote for all players except self
local function fireForOthers()
while toggled do
local aimPos = camera.CFrame.Position + camera.CFrame.LookVector * 10
for _, plr in pairs(game.Players:GetPlayers()) do
if plr ~= player and plr.Character then
local args = {
[1] = "slash",
[2] = plr.Character,
[3] = aimPos
}
pcall(function()
player.Character:WaitForChild("SlapTool").Event:FireServer(unpack(args))
end)
end
end
task.wait(0.1)
end
end
-- Toggle button click
toggleButton.MouseButton1Click:Connect(function()
toggled = not toggled
if toggled then
toggleButton.Text = "Toggle Slash (ON)"
toggleButton.BackgroundColor3 = Color3.fromRGB(60, 200, 60)
coroutine.wrap(fireForOthers)()
else
toggleButton.Text = "Toggle Slash (OFF)"
toggleButton.BackgroundColor3 = Color3.fromRGB(255, 60, 60)
end
end)
Awsome
Thx