GetRemoteEvent("FireRifle").OnServerEvent:Connect(function(player, from, to, damage)
local rayOrigin = from
local rayDirection = to - from
local raycastParams = RaycastParams.new();
raycastParams.FilterDescendantsInstances = CollectionService:GetTagged("Rifle")
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResult then
print("done.")
end
end)
Should be printing “done.” in the console but it isn’t. Running through the debugger all the variables are fine and the event is being fired, it’s just that raycastResult is nil. Why doesn’t this raycast work?