I opened my game that I haven’t touched in a few months, and saw that Enum.Blacklist got depreciated. So I switched to .Exclude, but now its messing with the camera even though I have it on the table that gets excluded.
Function:
(camera is a variable outside the function)
function raycast(instances)
local mouseLocation=UserInputService:GetMouseLocation()
local mouseRay=camera:ViewportPointToRay(mouseLocation.X,mouseLocation.Y)
local raycastParams=RaycastParams.new()
raycastParams.FilterType=Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances=instances
local raycastResult=workspace:Raycast(mouseRay.Origin,mouseRay.Direction*1000,raycastParams)
return raycastResult
end
How it’s being inputted:
game:GetService("RunService").RenderStepped:Connect(function()
if towerClone then
local result=raycast({towerClone,camera})
if result and result.Instance then
if result.Instance.Parent.Name=="TowerArea" then
canPlace=true
for i,object in pairs(towerClone:GetDescendants()) do
if object:IsA("BasePart") then
object.Color=Color3.new(0,1,0)
end
end
else
canPlace=false
for i,object in pairs(towerClone:GetDescendants()) do
if object:IsA("BasePart") then
object.Color=Color3.new(1,0,0)
end
end
end
towerClone.HumanoidRootPart.Anchored=false
towerClone:SetPrimaryPartCFrame(CFrame.new(
result.Position.X,
result.Position.Y+towerClone.Humanoid.HipHeight,
result.Position.Z
)*CFrame.Angles(0,math.rad(rotation),0)
)
else
towerClone.HumanoidRootPart.Anchored=true
end
end
end)