You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
code no work -
What is the issue? Include screenshots / videos if possible!

I’m using raycasting to detect when a wall is infront of my rig, but the raycast only detects the wall on certain sides. (The green rods are where the rig detected a wall) -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried moving the start of the raycast to slightly behind the rig and changing the rotation and position of the parts.
local PathfindingService = game:GetService("PathfindingService")
local RunService = game:GetService("RunService")
local rs = game:GetService("ReplicatedStorage")
local GameEvents = rs:WaitForChild("GameEvents")
local GameEnd = GameEvents:WaitForChild("GameEnd")
local GameStart = GameEvents:WaitForChild("GameStart")
local Zombie = script.Parent
local HRP = Zombie:WaitForChild("HumanoidRootPart")
local ZHum = Zombie:WaitForChild("Humanoid")
local Hidden = Zombie:WaitForChild("!Hidden")
local HumansFolder = workspace.Players.Human
-- Functions
local function LocateHuman()
local inRange = {}
local closest = 25
local target = nil
if #HumansFolder:GetChildren() < 1 then return end
for _, Human in pairs(HumansFolder:GetChildren())do
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {Human:GetChildren(), Zombie:GetChildren()}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local ray = workspace:Raycast(HRP.Position, Human.HumanoidRootPart.Position, raycastParams)
--print(Human)
if ray == nil then
local magnitude = (HRP.Position - Human.HumanoidRootPart.Position).Magnitude
--print(magnitude)
if magnitude <= 25 then
table.insert(inRange,
{Magnitude = magnitude,
Char = Human
})
end
end
end
for _, entry in pairs(inRange) do
local magnitude = entry.Magnitude
local char = entry.Char
if magnitude < closest then
closest = magnitude
target = char
end
--print(magnitude)
--print(target)
end
return target
end
local R2Params = RaycastParams.new()
R2Params.FilterType = Enum.RaycastFilterType.Exclude
task.wait(1)
R2Params.FilterDescendantsInstances = {workspace:WaitForChild("Players")}
local function FrontCheck()
local obstacle = false
local pos = (HRP.CFrame + HRP.CFrame.LookVector * 3 + Vector3.new(0, -1, 0)).Position
--part.Position = pos + Vector3.new(0, 1.5, 0)
local ray = workspace:Raycast(HRP.Position, pos, R2Params)
if ray then
local part = Instance.new("Part", workspace) -- testing purposes
part.Anchored = true
part.CanCollide = false
part.CanQuery = false
part.Material = Enum.Material.Neon
part.Color = Color3.new(0.239216, 1, 0.00784314)
part.Size = Vector3.new(0.2,3,0.2)
part.Position = ray.Position
print(ray.Instance)
print(ray.Instance.Parent)
ZHum.Jump = true
end
end
-- Connections
local waiting = false
RunService.Heartbeat:Connect(function()
local nearestHuman = LocateHuman()
FrontCheck() --jump
if nearestHuman == nil then return end
if waiting == true then return end
if nearestHuman.Humanoid.Health <= 0 then return end
ZHum:MoveTo(nearestHuman.HumanoidRootPart.Position)
end)
