I have a raycast that follows the players arms and legs, but its oriented into the ground most of the time, and flies off when your character is looking at specific angles, even though it should be looking directly forward
The white balls are whever the ray hits. They’re out of my render distance/gone when turned to the other side.
local player = game.Players.LocalPlayer
local debris = game:GetService("Debris")
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
player.CharacterAdded:Connect(function(char)
local attachments = {}
table.insert(attachments, char:WaitForChild("LeftHandGrip"))
table.insert(attachments, char:WaitForChild("RightHandGrip"))
table.insert(attachments, char:WaitForChild("LeftLegGrip"))
table.insert(attachments, char:WaitForChild("RightLegGrip"))
local attachmentParts = {}
for i, obj in attachments do
local part = Instance.new("Part")
part.Position = obj.WorldPosition
part.Orientation = obj.WorldOrientation
part.Size = Vector3.new(0.05, 0.05, 0.05)
part.CanCollide = false
part.Parent = workspace.Debris
part.Name = obj.Name.."Part"
local weld = Instance.new("WeldConstraint")
weld.Part0 = obj.Parent.PrimaryPart
weld.Part1 = part
weld.Parent = part
table.insert(attachmentParts, part)
end
while task.wait() and char do
for i, obj in attachmentParts do
params.FilterDescendantsInstances = {char:GetDescendants(), workspace.Debris:GetDescendants()}
local ray = workspace:Raycast(obj.Position, obj.Orientation, params)
if ray then
local part = Instance.new("Part")
part.Position = ray.Position
part.Orientation = Vector3.new(ray.Normal.X, ray.Normal.Y, ray.Normal.Z)
part.Size = Vector3.new(0.1, 0.1, 0.1)
part.Shape = Enum.PartType.Ball
part.Material = Enum.Material.Neon
part.Anchored = true
part.CanCollide = false
part.Parent = workspace.Debris
debris:AddItem(part, 0.05)
print(ray.Instance)
end
end
end
end)

