Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

WorldToScreenPoint when trying to find players?

Asked by 4 years ago

I am basically trying to search the parts of a player. I tried using a loop but nothing worked. What's the issue here?

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 are now incognito.")
    end
    wait(1)
end

Answer this question