Utilities.tweenFoV=function(X,N)if not _G.tweeningFov then coroutine.resume(coroutine.create(function()SFn=SFn and SFn+1 or 0 local K=SFn for V=1,N,1 do if SFn~=K then break end cam.FieldOfView=cam.FieldOfView+(X-cam.FieldOfView)*(V/N);(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:wait()end end))end end Utilities.tweenRoll=function(X,N)coroutine.resume(coroutine.create(function()local K=cam:GetRoll()for N=-90,90,N do local V=(math.sin(math.rad(N))+1)/2 cam:SetRoll(((Vector3.new(K,0,0)):Lerp(Vector3.new(X,0,0),V)).X)rs:wait()end end))end Utilities.Fade=function(X,N,K,V)coroutine.resume(coroutine.create(function()for f=1,K,1 do if V==true then X.TextTransparency=X.TextTransparency+(N-X.TextTransparency)*(f/K)rs:wait()elseif V==false then X.Size=X.Size+(N-X.Size)*(f/K)rs:wait()end end end))end Utilities.FixCam=function()cam.CameraSubject=player.Character.Humanoid cam.CameraType="\067\117\115\116\111\109"player.Character.Humanoid.WalkSpeed=32.5 end Utilities.SpawnCam=function(X)cam.CameraType="\065\116\116\097\099\104"cam.CameraSubject=X wait(.05)cam.CoordinateFrame=X.CFrame cam.CameraType="\083\099\114\105\112\116\097\098\108\101"player.Character.Humanoid.WalkSpeed=32.5 end Utilities.tweenCam=function(X,N)coroutine.resume(coroutine.create(function()COn=COn and COn+1 or 0 local K=COn for V=1,N,1 do if COn~=K then break end char.Humanoid.CameraOffset=char.Humanoid.CameraOffset+(X-char.Humanoid.CameraOffset)*(V/N)rs:wait()end end))end Utilities.TweenJoint=function(X,N,K,V,f)spawn(function()local q=math.random(-1000000000.0,1000000000.0)local s=nil if not X:findFirstChild("\116\119\101\101\110\067\111\100\101")then s=Instance.new("\073\110\116\086\097\108\117\101")s.Name="\116\119\101\101\110\067\111\100\101"s.Value=q s.Parent=X else s=X.tweenCode s.Value=q end if f<=0 then if N then X.C0=N end if K then X.C1=K end else local A=1.5/f local T=X.C0 local Y=X.C1 local G=0 while true do rs:wait()local f=G+A G=f>90 and 90 or f if s.Value~=q then break end if N then X.C0=T:lerp(N,V(G))end if K then X.C1=Y:lerp(K,V(G))end if G==90 then break end end end if s.Value==q then s:Destroy()end end)end Utilities.Weld=function(X,N,K)local V=Instance.new("\077\111\116\111\114\054\068",X)V.Part0=X V.Part1=N V.Name=X.Name V.C0=K or X.CFrame:inverse()*N.CFrame return V end return Utilities
--[[Utilities.tweenFoV = function(FOV,step)
	coroutine.resume(coroutine.create(function()
   		local fv0 = cam.FieldOfView
    	for i = 0,90,step do
        	local r = ((math.sin(math.rad(i))+1)/2)
        	cam.FieldOfView = (Vector3.new(fv0,0,0):Lerp(Vector3.new(FOV,0,0),r).X)
        	rs:wait()
    	end
	end))
end]]
--

Utilities.tweenFoV = function(goal, frames)
	if not _G.tweeningFov then
		coroutine.resume(coroutine.create(function()
			SFn = SFn and SFn + 1 or 0
			local SFn_S = SFn
			for i = 1, frames do
				if SFn ~= SFn_S then
					break
				end
				cam.FieldOfView = cam.FieldOfView + (goal - cam.FieldOfView) * (i / frames)
				game:GetService("RunService").RenderStepped:wait()
				--_G.tweeningFov = true
			end
			--_G.tweeningFov = false
		end))
	end
end

Utilities.tweenRoll = function(Roll, step)
	coroutine.resume(coroutine.create(function()
		local r0 = cam:GetRoll()
		for i = -90, 90, step do
			local r = ((math.sin(math.rad(i)) + 1) / 2)
			cam:SetRoll(Vector3.new(r0, 0, 0):Lerp(Vector3.new(Roll, 0, 0), r).X)
			rs:wait()
		end
	end))
end

Utilities.Fade = function(target, goal, frames, IsGui)
	coroutine.resume(coroutine.create(function()
		for i = 1, frames do
			if IsGui == true then
				target.TextTransparency = target.TextTransparency + (goal - target.TextTransparency) * (i / frames)
				rs:wait()
			elseif IsGui == false then
				target.Size = target.Size + (goal - target.Size) * (i / frames)
				rs:wait()
			end
		end
	end))
end

Utilities.FixCam = function()
	cam.CameraSubject = player.Character.Humanoid
	cam.CameraType = "Custom"
	player.Character.Humanoid.WalkSpeed = 32.5
end

Utilities.SpawnCam = function(Target)
	cam.CameraType = "Attach"
	cam.CameraSubject = Target
	wait(0.05)
	cam.CoordinateFrame = Target.CFrame
	cam.CameraType = "Scriptable"
	player.Character.Humanoid.WalkSpeed = 32.5
end

Utilities.tweenCam = function(CO, t)
	coroutine.resume(coroutine.create(function()
		COn = COn and COn + 1 or 0
		local COn_S = COn
		for i = 1, t do
			if COn ~= COn_S then
				break
			end
			char.Humanoid.CameraOffset = char.Humanoid.CameraOffset + (CO - char.Humanoid.CameraOffset) * (i / t)
			rs:wait()
		end
	end))
end

Utilities.TweenJoint = function(Joint, newC0, newC1, Alpha, Duration)
	spawn(function()
		local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
		local tweenIndicator = nil
		if not Joint:findFirstChild("tweenCode") then --If the joint isn't being tweened, then
			tweenIndicator = Instance.new("IntValue")
			tweenIndicator.Name = "tweenCode"
			tweenIndicator.Value = newCode
			tweenIndicator.Parent = Joint
		else
			tweenIndicator = Joint.tweenCode
			tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
		end
		if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
			if newC0 then
				Joint.C0 = newC0
			end
			if newC1 then
				Joint.C1 = newC1
			end
		else
			local Increment = 1.5 / Duration --Calculate the increment here so it doesn't need to be calculated in the loop
			local startC0 = Joint.C0
			local startC1 = Joint.C1
			local X = 0
			while true do
				rs:wait() --This makes the for loop step every 1/60th of a second
				local newX = X + Increment
				X = (newX > 90 and 90 or newX) --Makes sure the X never goes above 90
				if tweenIndicator.Value ~= newCode then
					break
				end --This makes sure that another tween wasn't called on the same joint
				if newC0 then
					Joint.C0 = startC0:lerp(newC0, Alpha(X))
				end
				if newC1 then
					Joint.C1 = startC1:lerp(newC1, Alpha(X))
				end
				if X == 90 then
					break
				end --If the tweening is done...
			end
		end
		if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
			tweenIndicator:Destroy()
		end
	end)
end

Utilities.Weld = function(p1, p2, c0)
	local w = Instance.new("Motor6D", p1)
	w.Part0 = p1
	w.Part1 = p2
	w.Name = p1.Name
	w.C0 = c0 or p1.CFrame:inverse() * p2.CFrame
	return w
end

return Utilities
