I’m working on a simple script that will make a model disappear if it is on-screen, for spooky purposes. I copied some code from the documentation, but it doesn’t seem to function.
local camera = workspace.CurrentCamera
local worldPoint = script.Parent.Position
while wait() do
local vector, inViewport = camera:WorldToViewportPoint(worldPoint)
local viewportPoint = Vector2.new(vector.X, vector.Y)
local depth = vector.Z
if inViewport then
print("AAAA")
game.Workspace.UnusedSounds["Boogie Funk Cops"]:Play()
end
end
It’s in a LocalScript located in the model’s head. It is neither printing nor playing the testing sound. What am I doing wrong?