local Ip = game.Players.LocalPlayer
local tweens = game:GetService("TweenService")
local character, humanoidRootPart
local function refreshCharacter(char)
character = char
humanoidRootPart = character:WaitForChild("HumanoidRootPart")
end
refreshCharacter(Ip.Character or Ip.CharacterAdded:Wait())
Ip.CharacterAdded:Connect(refreshCharacter)
function getRPG()
for _, tool in pairs(Ip.Character:GetChildren()) do
if tool:IsA("Tool") and tool:FindFirstChild("Shoot") then
return tool
end
end
for _, tool in pairs(Ip.Backpack:GetChildren()) do
if tool:IsA("Tool") and tool:FindFirstChild("Shoot") then
return tool
end
end
return nil
end
function shoot(player)
local rpg = getRPG()
if not rpg then return end
if rpg.Parent == Ip.Backpack then
Ip.Character:WaitForChild("Humanoid"):EquipTool(rpg)
task.wait(0.1)
end
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
if hrp then
local args = { hrp.Position }
rpg:WaitForChild("Shoot"):FireServer(unpack(args))
end
end
function tween(v, speed)
if character and humanoidRootPart then
local distance = (v.Position - humanoidRootPart.Position).Magnitude
local time = distance / speed
local tweeninfo = TweenInfo.new(time, Enum.EasingStyle.Linear)
local start_tween = tweens:Create(humanoidRootPart, tweeninfo, {CFrame = v.CFrame})
start_tween:Play()
return start_tween
end
end
function findenemy()
local enemy = nil
local near = math.huge
for _, player in pairs(game.Players:GetPlayers()) do
if player ~= Ip and player.Team ~= Ip.Team and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
local hrp = player.Character:WaitForChild("HumanoidRootPart")
local hm = player.Character:FindFirstChild("Humanoid")
if hrp and hm and hm.Health > 0 then
local distance = (humanoidRootPart.Position - hrp.Position).Magnitude
if distance < near then
near = distance
enemy = player
end
end
end
end
return enemy
end
local Rayfield = loadstring(game:HttpGet('https://[Log in to view URL]'))()
local Window = Rayfield:CreateWindow({
Name = "Khang Gay Hub | by huh",
Icon = 0, -- Icon in Topbar. Can use Lucide Icons (string) or Roblox Image (number). 0 to use no icon (default).
LoadingTitle = "Khang Gay Hub",
LoadingSubtitle = "by huh",
ShowText = "Rayfield", -- for mobile users to unhide rayfield, change if you'd like
Theme = "Default", -- Check https://[Log in to view URL]
ToggleUIKeybind = "K", -- The keybind to toggle the UI visibility (string like "K" or Enum.KeyCode)
DisableRayfieldPrompts = false,
DisableBuildWarnings = false, -- Prevents Rayfield from warning when the script has a version mismatch with the interface
ConfigurationSaving = {
Enabled = true,
FolderName = nil, -- Create a custom folder for your hub/game
FileName = "Big Hub"
},
Discord = {
Enabled = false, -- Prompt the user to join your Discord server if their executor supports it
Invite = "noinvitelink", -- The Discord invite code, do not include discord.gg/. E.g. discord.gg/ ABCD would be ABCD
RememberJoins = true -- Set this to false to make them join the discord every time they load it up
},
KeySystem = false, -- Set this to true to use our key system
KeySettings = {
Title = "Untitled",
Subtitle = "Key System",
Note = "No method of obtaining the key is provided", -- Use this to tell the user how to get a key
FileName = "Key", -- It is recommended to use something unique as other scripts using Rayfield may overwrite your key file
SaveKey = true, -- The user's key will be saved, but if you change the key, they will be unable to use your script
GrabKeyFromSite = false, -- If this is true, set Key below to the RAW site you would like Rayfield to get the key from
Key = {"Hello"} -- List of keys that will be accepted by the system, can be RAW file links (pastebin, github etc) or simple strings ("hello","key22")
}
})
local Tab = Window:CreateTab("Main", 4483362458)
local Section = Tab:CreateSection("Auto Kill Player")
local Toggle = Tab:CreateToggle({
Name = "Auto Kill",
CurrentValue = false,
Flag = "Toggle1",
Callback = function(Value)
_G.AutoKill = Value
end,
})
spawn(function()
while task.wait(0) do
if _G.AutoKill and character and humanoidRootPart then
local enemy = findenemy()
if enemy then
tween(enemy.Character.HumanoidRootPart, 300)
shoot(enemy)
end
end
end
end)
To embed this project on your website, copy the following code and paste it into your website's HTML: