ok so im thinking of a way . to make my script go through walls but its not going through walls and I cant think of a way does anyone know how I can make raycasts go through walls?
wait() local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() local tool = script.Parent local Handle = tool.Handle tool.Activated:Connect(function() local MouseHitPoint = mouse.Hit.p local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 2048) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("Bright red") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) if part then local Hum = part:FindFirstChild('Humanoid') or part.Parent:FindFirstChild('Humanoid') if Hum then Hum:TakeDamage(20) end end end)
On Line 29 you can put
local part,position =workspace:FindPartOnRayWithIgnoreList(ray,Origin,FolderWithWallsInside:GetChildren())
just have the parent of all the walls in something like a folder so it can ignore all the walls, because the ignore list has to be a table