local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local Debris = game:GetService("Debris")

local localPlayer = Players.LocalPlayer
local originalRaycast = Workspace.Raycast

-- 기능 제어 변수 (각각 따로 관리)
local WallbangEnabled = false
local SilentAimEnabled = false
local Whitelist = {}

-- 가장 가까운 적을 찾는 함수 (자신 및 제외 명단 유저 배제)
local function getClosestPlayer(origin)
	local closestPlayer = nil
	local shortestDistance = math.huge

	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer and not Whitelist[player.Name] and player.Character then
			local char = player.Character
			local hrp = char:FindFirstChild("HumanoidRootPart")
			local hum = char:FindFirstChildOfClass("Humanoid")

			if hrp and hum and hum.Health > 0 then
				local distance = (hrp.Position - origin).Magnitude
				if distance < shortestDistance then
					shortestDistance = distance
					closestPlayer = player
				end
			end
		end
	end
	return closestPlayer
end

-- 궤적 이펙트 함수 (2초 유지 노란색 빔)
local function drawTracer(startPos, endPos)
	local attachment0 = Instance.new("Attachment")
	attachment0.Position = startPos
	attachment0.Parent = Workspace.Terrain

	local attachment1 = Instance.new("Attachment")
	attachment1.Position = endPos
	attachment1.Parent = Workspace.Terrain

	local beam = Instance.new("Beam")
	beam.Attachment0 = attachment0
	beam.Attachment1 = attachment1
	beam.Width0 = 0.1
	beam.Width1 = 0.1
	beam.Color = ColorSequence.new(Color3.fromRGB(255, 230, 0))
	beam.FaceCamera = true
	beam.Parent = Workspace.Terrain

	Debris:AddItem(attachment0, 2)
	Debris:AddItem(attachment1, 2)
	Debris:AddItem(beam, 2)
end

-- [핵심] 전역 레이캐스트 변조 통합 제어부
Workspace.Raycast = function(self, origin, direction, userParams)
	-- 두 기능이 모두 꺼져있으면 순정 상태로 실행
	if not WallbangEnabled and not SilentAimEnabled then
		return originalRaycast(Workspace, origin, direction, userParams)
	end

	-- 1. 방향 설정 (유도탄이 켜져있으면 적 방향으로, 꺼져있으면 원래 조준 방향으로)
	local finalDirection = direction
	if SilentAimEnabled then
		local targetPlayer = getClosestPlayer(origin)
		if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
			local targetHrp = targetPlayer.Character.HumanoidRootPart
			finalDirection = (targetHrp.Position - origin).Unit * direction.Magnitude
		end
	end

	-- RaycastParams 설정 (자신 제외)
	local raycastParams = userParams or RaycastParams.new()
	raycastParams.FilterType = Enum.RaycastFilterType.Exclude
	local currentFilter = raycastParams.FilterDescendantsInstances or {}
	if localPlayer.Character and not table.find(currentFilter, localPlayer.Character) then
		table.insert(currentFilter, localPlayer.Character)
	end
	raycastParams.FilterDescendantsInstances = currentFilter

	-- 변수 선언
	local maxDistance = finalDirection.Magnitude
	local dirUnit = finalDirection.Unit
	local currentDistance = 0
	local currentOrigin = origin
	
	local finalResult = nil
	local finalHitPosition = origin + finalDirection

	-- 2. 관통 여부에 따른 레이캐스트 처리
	if WallbangEnabled then
		-- [벽 관통 활성화 루프]
		while currentDistance < maxDistance do
			local remainingDistance = maxDistance - currentDistance
			local raycastResult = originalRaycast(Workspace, currentOrigin, dirUnit * remainingDistance, raycastParams)
			
			if not raycastResult then
				break
			end
			
			local hitInstance = raycastResult.Instance
			local hitPosition = raycastResult.Position
			
			currentDistance = currentDistance + (hitPosition - currentOrigin).Magnitude
			finalHitPosition = hitPosition
			finalResult = raycastResult
			
			local character = hitInstance.Parent
			local humanoid = character:FindFirstChildOfClass("Humanoid") or (character.Parent and character.Parent:FindFirstChildOfClass("Humanoid"))
			
			if humanoid then
				break
			else
				local updatedFilter = raycastParams.FilterDescendantsInstances
				table.insert(updatedFilter, hitInstance)
				raycastParams.FilterDescendantsInstances = updatedFilter
				
				currentOrigin = hitPosition + (dirUnit * 0.05)
				finalResult = nil
			end
		end
	else
		-- [벽 관통 비활성화] 일반 레이캐스트 1회 진행 (벽에 막힘)
		finalResult = originalRaycast(Workspace, origin, finalDirection, raycastParams)
		if finalResult then
			finalHitPosition = finalResult.Position
		end
	end

	-- 노란색 총알 궤적 생성 (2초 유지)
	drawTracer(origin, finalHitPosition)

	return finalResult
end

--------------------------------------------------------------------
-- Rayfield UI 셋업
--------------------------------------------------------------------
local Rayfield = loadstring(game:HttpGet('https://[Log in to view URL]'))()

local Window = Rayfield:CreateWindow({
   Name = "사일런스 에임이랑 총알 벽 관통 스크립트",
   LoadingTitle = "Loading....",
   LoadingSubtitle = "제작 : 마인민이",
   ConfigurationSaving = { Enabled = false },
   KeySystem = false
})

local MainTab = Window:CreateTab("Main", nil)
local CombatSection = MainTab:CreateSection("Gun Mods")

-- 1. 벽 관통 토글 버튼
local WallbangToggle = MainTab:CreateToggle({
   Name = "Wallbang (총알 벽 관통)",
   CurrentValue = false,
   Flag = "WallbangToggleFlag",
   Callback = function(Value)
      WallbangEnabled = Value
   end,
})

-- 2. 유도탄 토글 버튼
local SilentAimToggle = MainTab:CreateToggle({
   Name = "Silent Aim (자동 유도탄)",
   CurrentValue = false,
   Flag = "SilentAimToggleFlag",
   Callback = function(Value)
      SilentAimEnabled = Value
   end,
})

local WhitelistSection = MainTab:CreateSection("Exclusion List")

-- 유저 목록 갱신용 함수
local function getPlayerNames()
	local names = {}
	for _, p in ipairs(Players:GetPlayers()) do
		if p ~= localPlayer then
			table.insert(names, p.Name)
		end
	end
	return names
end

-- 3. 유도 제외 명단 드롭다운
local WhitelistDropdown = MainTab:CreateDropdown({
   Name = "유도탄에서 제외할 사람",
   Options = getPlayerNames(),
   CurrentOption = {},
   MultipleOptions = true,
   Flag = "WhitelistDropdownFlag",
   Callback = function(Options)
      Whitelist = {}
      for _, name in ipairs(Options) do
         Whitelist[name] = true
      end
   end,
})

local function updateDropdown()
	WhitelistDropdown:Refresh(getPlayerNames(), true)
end

Players.PlayerAdded:Connect(updateDropdown)
Players.PlayerRemoving:Connect(updateDropdown)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: