As I wish for the raycast to only go a certain distance, as I’m creating a mining system and making sure that the player is within reasonable distance of the ore is what I wish to do. I’m rather new to using the raycast system, thus any help would be appreciated! Below you’ll find the code I already have in terms of raycasting
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {workspace:FindFirstChildOfClass("Terrain")}
Pickaxe.Activated:Connect(function()
Hitbox.Touched:Connect(function() end)
local function Check()
for _, part in pairs(Hitbox:GetTouchingParts()) do
Count += 1
local Cast = workspace:Raycast(Handle.Position, Handle.CFrame.LookVector * 2, params)