In my game, I want a sound to play when you are put in FPS mode, but I need to know how it would sound only at that point, does anyone have any idea how this would work? I know you wouldn't use FieldOfView becuase that changes everything around... Can anyone please help me?
The best way to do this is check the distance between the CurrentCamera and the Head. I would use magnitude for this like so
local Magnitude = (CurrentCamera.CoordinateFrame.p - Head.CFrame.p).magnitude
Usually the magnitude is around 1 stud when you are zoomed into first person.
if Magnitude <= 1 then -- do stuff() end
To make this work though, you would have to put this in a while loop because I'm pretty sure .Changed doesn't fire for CoordinateFrame. Also, to make your sound only run when you get put in first person, we can make a variable named ZoomedIn and if it is already true than not play the sound.
local ZoomedIn = false while true do wait(.01) local Magnitude = (CurrentCamera.CoordinateFrame.p - Head.CFrame.p).magnitude if Magnitude <= 1 and ZoomedIn == false then -- sound stuff ZoomedIn = true else ZoomedIn = false end end