local ReplicatedStorage = game:GetService("ReplicatedStorage") local rq = ReplicatedStorage:WaitForChild("HDAdminHDClient").Signals.RequestCommandSilent local player = game.Players.LocalPlayer local mouse = player:GetMouse() local equipped = false local char = player.Character or player.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local hed = char:WaitForChild("Head") local tool = nil local SHOOT_DURATION = 0.25 local ANIM_SPEED = 1.5 local MAX_DISTANCE = 7 for i = 1, 20 do for _, v in player:GetDescendants() do if v.Name == "SyncAPI" then tool = v.Parent break end end if not tool then for _, v in game.ReplicatedStorage:GetDescendants() do if v.Name == "SyncAPI" then tool = v.Parent break end end end if tool then break end task.wait(0.5) end if not tool then error("little skiddomjust get btools first") end local remote = tool:WaitForChild("SyncAPI"):WaitForChild("ServerEndpoint") local function _(args) task.spawn(function() remote:InvokeServer(unpack(args)) end) end function SetCollision(part, boolean) local args = { "SyncCollision", { { ["Part"] = part, ["CanCollide"] = boolean } } } _(args) end function SetAnchor(boolean, part) local args = { "SyncAnchor", { { ["Part"] = part, ["Anchored"] = boolean } } } _(args) end function CreatePart(cf, parent) local args = { "CreatePart", "Normal", cf, parent } _(args) end function DestroyPart(part) local args = { "Remove", { part } } _(args) end function MovePart(part, cf) local args = { "SyncMove", { { ["Part"] = part, ["CFrame"] = cf } } } _(args) end function Resize(part, size, cf) local args = { "SyncResize", { { ["Part"] = part, ["CFrame"] = cf, ["Size"] = size } } } _(args) end function AddMesh(part) local args = { "CreateMeshes", { { ["Part"] = part } } } _(args) end function reflect(part, int) local args = { "SyncMaterial", { { ["Part"] = part, ["Reflectance"] = int } } } _(args) end function SetMesh(part, meshid, offset) local args = { "SyncMesh", { { ["Part"] = part, ["MeshId"] = "rbxassetid://"..meshid, ["Offset"] = offset } } } _(args) end function SetTexture(part, texid) local args = { "SyncMesh", { { ["Part"] = part, ["TextureId"] = "rbxassetid://"..texid } } } _(args) end function SetName(part, stringg) local args = { "SetName", { part }, stringg } _(args) end function MeshResize(part, size) local args = { "SyncMesh", { { ["Part"] = part, ["Scale"] = size } } } _(args) end function Weld(part1, part2, lead) local args = { "CreateWelds", { part1, part2 }, lead } _(args) end function SetTrans(part, int) local args = { "SyncMaterial", { { ["Part"] = part, ["Transparency"] = int } } } _(args) end function Color(part, color) local args = { "SyncColor", { { ["Part"] = part, ["Color"] = color, ["UnionColoring"] = false } } } end local hiddenCFrame = CFrame.new(0, 99999, 0) local gun local success, result = pcall(function() return remote:InvokeServer("CreatePart", "Normal", hiddenCFrame, char) end) if success and result then gun = result task.spawn(function() AddMesh(gun) SetMesh(gun, "8827558932", Vector3.new(-1, 0, 1.5)) SetTexture(gun, "8827665405") SetName(gun, "dev uzi") SetCollision(gun, false) MeshResize(gun, Vector3.new(0.2, 0.2, 0.2)) MovePart(gun, char:WaitForChild("Right Arm").CFrame * CFrame.Angles(math.rad(-180), math.rad(0), math.rad(-90))) task.wait(0.1) Weld(gun, char["Right Arm"], gun) wait(0.1) SetAnchor(false, gun) SetTrans(gun, 1) end) else warn("Failed to create gun part via SyncAPI. Are you sure you have building permissions?") end local dev = Instance.new('Tool') dev.Name = "Diamond sword" dev.RequiresHandle = false dev.Parent = player:WaitForChild("Backpack") local hold = Instance.new('Animation') hold.AnimationId = 'rbxassetid://182393478' local hoId = hum:LoadAnimation(hold) hoId.Looped = true local shootAnim = Instance.new('Animation') shootAnim.AnimationId = 'rbxassetid://74813494' local shootId = hum:LoadAnimation(shootAnim) shootId.Looped = false -- เปลี่ยนเป็น false เพราะต้องการให้เล่นจบเป็นรอบๆ ไป local function getClosePlayerInFront() local targetPlayer = nil for _, p in game.Players:GetPlayers() do if p ~= player and p.Character and p.Character:FindFirstChild("Head") then local enemyHead = p.Character.Head local distance = (hed.Position - enemyHead.Position).Magnitude if distance <= MAX_DISTANCE then local directionToEnemy = (enemyHead.Position - hed.Position).Unit local facingDirection = hed.CFrame.LookVector local dotProduct = facingDirection:Dot(directionToEnemy) if dotProduct > 0.7 then targetPlayer = p break end end end end return targetPlayer end dev.Equipped:Connect(function() if gun then SetTrans(gun, 0) end hoId:Play() equipped = true end) dev.Unequipped:Connect(function() if gun then SetTrans(gun, 1) end hoId:Stop() shootId:Stop() equipped = false end) mouse.Button1Down:Connect(function() if equipped then shootId:Play() shootId:AdjustSpeed(ANIM_SPEED) local target = getClosePlayerInFront() if target then rq:InvokeServer(";damage " .. target.Name .. " 35") end task.delay(SHOOT_DURATION, function() shootId:Stop() end) end end)