My goal is to make a corner clip fix script (since corner clipping was patched as of december 10th, 2021) but I don’t know how to detect when someone enters first person/shift lock to even start on this.
Does anyone know how to detect when a player enters first person/shift lock?
EDIT: I found out how to detect shift lock, now I need to find out how to detect first person.
My shift lock detection script:
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
-- code
end
there are a few different methods to go about this
Checking the humanoid camera offset:
simply just use an if statement on the humanoid and check to see if the camera is offsetted, by default i think the offset is Vector3.new(3, 0.2, 0).
so just do if hum.CameraOffset == Vector3.new(3, 0.2, 0) then blah blah blah blah end
Actually fiddle with the shift lock code, and use a bool value and toggle it whenever enabled/disabled
checking if the mouse is locked or not.
i would highly advise against this if you have zooming into first person enabled.
I found this unique property which supposedly gives you the Transparency of your Character’s BaseParts from the local side
As when you zoom into first person, your Character’s BaseParts turn transparent although I am unsure if you can detect it’s changed property signal you could use a RenderStepped event to check if the Transparency is equal to 1
local RunService = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
--If this first one doesn't work, stick with the RenderStepped event
Head:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
if Head.LocalTransparencyModifier == 1 then
-- Rando Code Here
end
end)
--RunService.RenderStepped:Connect(function()
--if Head.LocalTransparencyModifier == 1 then
-- Rando Code Here
--end
--end)