我想知道是否可以使用 WorldToScreenPoint 来观看播放器。我尝试使用循环来检测播放器的各个部分,但没有任何效果。
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
while true do
local Vector, InScreen = Camera:WorldToScreenPoint(Character)
if InScreen then
for i, v in pairs(Character:GetChildren()) do
for i, r in pairs(game.Teams.Red:GetPlayers()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
print(v.Name.." has been detected!")
end
end
end
else
print("You're away!")
end
wait(1)
end