I have this lock on script, but it isnt togglable. Ive tried to make it toggleable by using booleans but it didnt work. I think it didnt work cause im using run service but idk
Heres the script
repeat task.wait(1) until game:IsLoaded() task.wait(1)
local rs = game:FindService("RunService") or game:GetService("RunService")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local camera = game.Workspace.CurrentCamera
local UIS = game:FindService("UserInputService") or game:GetService("UserInputService")
local bool = false
local char = plr.Character
local rootPart = char.HumanoidRootPart
local TS = game:FindService("TweenService") or game:GetService("TweenService")
UIS.InputBegan:Connect(function(input, chat)
if chat then return end
if input.UserInputType == Enum.UserInputType.MouseButton3 and bool == false then
bool = true
rs.RenderStepped:Connect(function(fps)
camera.CameraType = Enum.CameraType.Scriptable
mouse.Icon ="rbxassetid://8399591114"
print("h")
local MPos = mouse.Hit.p
local info = TweenInfo.new(1)
local tweem = TS:Create(camera, info, {CFrame = CFrame.new(camera.CFrame.Position, MPos)})
tweem:Play()
camera.CameraType = Enum.CameraType.Custom
end)
end
end)
Help is appreciated, thank you for your time