I'm trying to do something when someone comes into the view of a player. I was given to use GetPartsObscuringTarget and WorldToScreenPoint together, but it's not working.
EDIT: This has been an issue for the past 3 days so I really need help.
This is how much I have so far:
game:GetService("RunService").RenderStepped:connect(function()
local function XRay(castPoints, ignoreList)
ignoreList = ignoreList or {}
local parts = workspace.CurrentCamera:GetPartsObscuringTarget(castPoints, ignoreList)
for _, part in pairs(parts) do
part.LocalTransparencyModifier = 0.75
for _, child in pairs(part:GetChildren()) do
if child:IsA("Decal") or child:IsA("Texture") then
child.LocalTransparencyModifier = 0.75
end
end
end
end
end)

1 comment
If i helped, please accept my answer so i can get reputation. Thank You!