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

How do I make the mouse break free when you hold left control? [closed]

Asked by
Stravan 18
8 years ago
self = script.Parent
c = workspace.CurrentCamera
rs = game:GetService("RunService")

player = game.Players.LocalPlayer
char = player.Character or player.CharacterAdded:wait()
humanoid = char:WaitForChild("Humanoid")

player.CameraMaxZoomDistance = 0.5
humanoid.CameraOffset = Vector3.new(0,0,-0.5)

function updateCam()
    if humanoid then
        local y = c.CoordinateFrame.lookVector.Y
        humanoid.CameraOffset = Vector3.new(math.max(3,1.5-y),math.abs(y/2)-y*3.8642337322235,7-math.abs(y))
    end
end

function lock(part)
    if part and part:IsA("Hat") and part:WaitForChild("Handle") then 
        part = part.Handle
    end
    if part and part:IsA("BasePart") then
        part.LocalTransparencyModifier = 0
        part.Changed:connect(function ()
            part.LocalTransparencyModifier = 0
        end)
    end
end

for _,v in pairs(char:GetChildren()) do
    lock(v)
end

char.ChildAdded:connect(lock)
rs.RenderStepped:connect(updateCam)

i've been struggling with this for a while. :(

0
What exactly are you asking? TheHospitalDev 1134 — 8y

Closed as Too Broad by TheHospitalDev, User#5423, and User#6546

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Why was this question closed?