My raycast keeps detecting the baseplate, I want to detect if you hit a enemy,code with problems:
local Item = MS.Target
local Origin = HRP
local FCT = coroutine.wrap(function()
local FRY = Ray.new(Origin.Position,(Item.Position - Origin.Position))
local Hit, position = workspace:FindPartOnRayWithIgnoreList(FRY,false)
print(Hit)
end)
local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
RayParams.FilterDescendantsInstances = {insert the things u want to blacklist}
local RayHit = game.Workspace:Raycast(position, direction, RayParams)
if RayHit then
print(RayHit.Instance)
end
local Item = MS.Hit
local Origin = HRP
local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
RayParams.FilterDescendantsInstances = {Origin,game.Workspace.Baseplate}
local FCT = coroutine.wrap(function()
local RayHit = game.Workspace:Raycast(Origin,Item.Position - Origin.Position,RayParams)
if RayHit then
print(RayHit.Instance)
end