local Players = game:GetService("Players") local player = Players.LocalPlayer local mouse = player:GetMouse() local playerGui = player:WaitForChild("PlayerGui") local toolFolder, remote for i, v in player:GetDescendants() do if v.Name == "SyncAPI" then toolFolder = v.Parent end end for i, v in game.ReplicatedStorage:GetDescendants() do if v.Name == "SyncAPI" then toolFolder = v.Parent end end if not toolFolder then warn("F3X SyncAPI not found!") return end remote = toolFolder.SyncAPI.ServerEndpoint function _(args) remote:InvokeServer(unpack(args)) end function CreatePart(cf, parent) local args = { [1] = "CreatePart", [2] = "Normal", [3] = cf, [4] = parent } return remote:InvokeServer(unpack(args)) end function DestroyPart(part) local args = { [1] = "Remove", [2] = { [1] = part } } _(args) end function Resize(part, size, cf) local args = { [1] = "SyncResize", [2] = { [1] = { ["Part"] = part, ["CFrame"] = cf, ["Size"] = size } } } _(args) end function MovePart(part, cf) local args = { [1] = "SyncMove", [2] = { [1] = { ["Part"] = part, ["CFrame"] = cf } } } _(args) end local maxAmmo = 10 local currentAmmo = maxAmmo local isReloading = false local screenGui = Instance.new("ScreenGui") screenGui.Name = "F3X_GunGUI" screenGui.ResetOnSpawn = false screenGui.Enabled = false screenGui.Parent = playerGui local ammoLabel = Instance.new("TextLabel") ammoLabel.Size = UDim2.new(0, 160, 0, 40) ammoLabel.Position = UDim2.new(1, -180, 1, -100) ammoLabel.BackgroundColor3 = Color3.fromRGB(30, 30, 30) ammoLabel.TextColor3 = Color3.fromRGB(255, 255, 255) ammoLabel.Font = Enum.Font.SourceSansBold ammoLabel.TextSize = 20 ammoLabel.Text = "Ammo: 10 / 10" ammoLabel.Parent = screenGui local reloadButton = Instance.new("TextButton") reloadButton.Size = UDim2.new(0, 160, 0, 40) reloadButton.Position = UDim2.new(1, -180, 1, -50) reloadButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60) reloadButton.TextColor3 = Color3.fromRGB(255, 255, 255) reloadButton.Font = Enum.Font.SourceSansBold reloadButton.TextSize = 18 reloadButton.Text = "Reload" reloadButton.Parent = screenGui local function updateAmmoUI() if isReloading then ammoLabel.Text = "Reloading..." else ammoLabel.Text = "Ammo: " .. currentAmmo .. " / " .. maxAmmo end end reloadButton.MouseButton1Click:Connect(function() if isReloading or currentAmmo == maxAmmo then return end isReloading = true updateAmmoUI() task.wait(1.5) currentAmmo = maxAmmo isReloading = false updateAmmoUI() end) local tool = Instance.new("Tool") tool.Name = "F3X Advanced Combat Gun" tool.RequiresHandle = true tool.Parent = player:WaitForChild("Backpack") local handle = Instance.new("Part") handle.Name = "Handle" handle.Size = Vector3.new(0.5, 1.1, 0.7) handle.BrickColor = BrickColor.new("Dark stone grey") handle.Parent = tool local frame = Instance.new("Part") frame.Name = "Frame" frame.Size = Vector3.new(0.5, 0.6, 1.8) frame.CFrame = handle.CFrame + Vector3.new(0, 0.85, -0.4) frame.BrickColor = BrickColor.new("Dark stone grey") frame.Parent = tool local frameWeld = Instance.new("WeldConstraint") frameWeld.Part0 = handle frameWeld.Part1 = frame frameWeld.Parent = handle local slide = Instance.new("Part") slide.Name = "Slide" slide.Size = Vector3.new(0.55, 0.7, 2.3) slide.CFrame = handle.CFrame + Vector3.new(0, 1.5, -0.5) slide.BrickColor = BrickColor.new("Black") slide.Parent = tool local slideWeld = Instance.new("WeldConstraint") slideWeld.Part0 = handle slideWeld.Part1 = slide slideWeld.Parent = handle local barrel = Instance.new("Part") barrel.Name = "Barrel" barrel.Size = Vector3.new(0.35, 0.35, 2.5) barrel.CFrame = handle.CFrame + Vector3.new(0, 1.5, -0.7) barrel.BrickColor = BrickColor.new("Metallic") barrel.Parent = tool local barrelWeld = Instance.new("WeldConstraint") barrelWeld.Part0 = handle barrelWeld.Part1 = barrel barrelWeld.Parent = handle local triggerGuard = Instance.new("Part") triggerGuard.Name = "TriggerGuard" triggerGuard.Size = Vector3.new(0.2, 0.5, 0.8) triggerGuard.CFrame = handle.CFrame + Vector3.new(0, -0.3, -0.45) triggerGuard.BrickColor = BrickColor.new("Black") triggerGuard.Parent = tool local guardWeld = Instance.new("WeldConstraint") guardWeld.Part0 = handle guardWeld.Part1 = triggerGuard guardWeld.Parent = handle local trigger = Instance.new("Part") trigger.Name = "Trigger" trigger.Size = Vector3.new(0.15, 0.35, 0.2) trigger.CFrame = handle.CFrame + Vector3.new(0, -0.2, -0.4) trigger.BrickColor = BrickColor.new("Medium stone grey") trigger.Parent = tool local triggerWeld = Instance.new("WeldConstraint") triggerWeld.Part0 = handle triggerWeld.Part1 = trigger triggerWeld.Parent = handle local hammer = Instance.new("Part") hammer.Name = "Hammer" hammer.Size = Vector3.new(0.2, 0.4, 0.3) hammer.CFrame = handle.CFrame + Vector3.new(0, 1.6, 0.7) hammer.BrickColor = BrickColor.new("Dark stone grey") hammer.Parent = tool local hammerWeld = Instance.new("WeldConstraint") hammerWeld.Part0 = handle hammerWeld.Part1 = hammer hammerWeld.Parent = handle local magazine = Instance.new("Part") magazine.Name = "Magazine" magazine.Size = Vector3.new(0.4, 1.0, 0.6) magazine.CFrame = handle.CFrame + Vector3.new(0, -0.1, 0) magazine.BrickColor = BrickColor.new("Matte Blue-Grey") magazine.Parent = tool local magWeld = Instance.new("WeldConstraint") magWeld.Part0 = handle magWeld.Part1 = magazine magWeld.Parent = handle local equippedConnection tool.Equipped:Connect(function() screenGui.Enabled = true updateAmmoUI() if equippedConnection then equippedConnection:Disconnect() end equippedConnection = mouse.Button1Down:Connect(function() if isReloading or currentAmmo <= 0 then return end local character = player.Character if not character or not character:FindFirstChild("Head") then return end currentAmmo = currentAmmo - 1 updateAmmoUI() local headCFrame = character.Head.CFrame local spawnCFrame = headCFrame + (headCFrame.LookVector * 4) local targetHitPos = mouse.Hit local direction = (targetHitPos.Position - spawnCFrame.Position).Unit local bulletCFrame = CFrame.new(spawnCFrame.Position, spawnCFrame.Position + direction) local success, createdPart = pcall(function() return CreatePart(bulletCFrame, workspace) end) if success and createdPart then local distance = (targetHitPos.Position - spawnCFrame.Position).Magnitude local bulletSpeed = 450 local duration = math.clamp(distance / bulletSpeed, 0.04, 0.6) Resize(createdPart, Vector3.new(0.3, 0.3, math.min(distance, 4)), bulletCFrame) task.spawn(function() local runService = game:GetService("RunService") local elapsed = 0 while elapsed < duration do local dt = runService.Heartbeat:Wait() elapsed = elapsed + dt local alpha = math.clamp(elapsed / duration, 0, 1) local currentPos = spawnCFrame.Position:Lerp(targetHitPos.Position, alpha) local currentCf = CFrame.new(currentPos, currentPos + direction) pcall(function() MovePart(createdPart, currentCf) end) end local targetHit = mouse.Target if targetHit and targetHit.Parent then local hitModel = targetHit.Parent local humanoid = hitModel:FindFirstChildOfClass("Humanoid") if humanoid and hitModel ~= character then pcall(function() DestroyPart(targetHit) end) end end pcall(function() DestroyPart(createdPart) end) end) end end) end) tool.Unequipped:Connect(function() screenGui.Enabled = false if equippedConnection then equippedConnection:Disconnect() end end)