I asked this before but I don’t know how to replace this either.
local ray = workspace.CurrentCamera:ViewportPointToRay(Mouse.x,Mouse.y,1000)
local part, hit = workspace:FindPartOnRayWithIgnoreList(ray, {Character, workspace.CurrentCamera, script.Parent.Handle})
You could get the Camera’s CFrame Position instead I believe, we’ll need to do a bit of tinkering (Raycast Result, RaycastParams, etc)
Maybe you could do something like this?
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Parameters = RaycastParams.new()
Parameters.FilterType = Enum.RaycastFilterType.Blacklist
Parameters.FilterDescendantsInstances = {Character, workspace.CurrentCamera, script.Parent.Handle}
local Head = Character:WaitForChild("Head")
local RayPosition = workspace.CurrentCamera.CFrame.Position
local RayDirection = (Head.Position - workspace.CurrentCamera.CFrame.Position).Unit * 1000
local RayResult = workspace:Raycast(RayPosition, RayDirection, Parameters)
if RayResult then
--Do something here
print("Instance Hit: "..RayResult.Instance)
print("Position HIt: "..RayResult.Position)
else
print("Nothing was found")
end
I swear I’m gonna get at least 1 of these things wrong