wait(1)RunService.RenderStepped:Connect(function()for Q,R in pairs(workspace.Map:GetChildren())do local Y=workspace.CurrentCamera.CFrame.Position local n=(R:GetPivot()).Position Y=Vector3.new(Y.X,0,Y.Z)n=Vector3.new(n.X,0,n.Z)local x=(Y-n).Magnitude x=x-3000 if x<0 then x=0 end x=(x*x)/3000 local D=(CFrame.new(R:GetAttribute("\079\114\105\103\105\110\097\108\080\111\115\105\116\105\111\110")-Vector3.new(0,x/50,0))).Position if not isPositionOnScreen(R:GetAttribute("\079\114\105\103\105\110\097\108\080\111\115\105\116\105\111\110")-Vector3.new(0,x/50,0))then x=100000000 R:PivotTo(CFrame.new(R:GetAttribute("\079\114\105\103\105\110\097\108\080\111\115\105\116\105\111\110")-Vector3.new(0,x/50,0))*(R:GetPivot()).Rotation)elseif isPositionOnScreen(R:GetAttribute("\079\114\105\103\105\110\097\108\080\111\115\105\116\105\111\110")-Vector3.new(0,x/50,0))then R:PivotTo(CFrame.new(R:GetAttribute("\079\114\105\103\105\110\097\108\080\111\115\105\116\105\111\110")-Vector3.new(0,x/50,0))*(R:GetPivot()).Rotation)end end end)

wait(1)
RunService.RenderStepped:Connect(function()

	for i,v in pairs(workspace.Map:GetChildren()) do

		local CamPos = workspace.CurrentCamera.CFrame.Position
		local vPos = v:GetPivot().Position

		CamPos = Vector3.new(CamPos.X, 0, CamPos.Z)
		vPos = Vector3.new(vPos.X, 0, vPos.Z)
		local dist = (CamPos - vPos).Magnitude

		dist = dist - 3000
		if dist < 0 then
			dist = 0
		end
		dist = dist*dist/3000
		local currentPos = CFrame.new(v:GetAttribute("OriginalPosition") - Vector3.new(0, dist/50, 0)).Position
	--[[
	local refinedPosHeight
	if v:isA("BasePart") then
		refinedPosHeight = Vector3.new(0, currentPos.Y + v.Size.Y/2, 0)
	else
		local cframe, size = v:GetBoundingBox()
		refinedPosHeight = Vector3.new(0, currentPos.Y + size.Y/2, 0)
	end

	if refinedPosHeight.Y < CamPos.Y - 200 then
		dist = 1000000
	end
	]]
		if not isPositionOnScreen(v:GetAttribute("OriginalPosition") - Vector3.new(0, dist/50, 0)) then
			dist = 100000000

			v:PivotTo(CFrame.new(v:GetAttribute("OriginalPosition") - Vector3.new(0, dist/50, 0)) * v:GetPivot().Rotation)
		elseif isPositionOnScreen(v:GetAttribute("OriginalPosition") - Vector3.new(0, dist/50, 0)) then
			v:PivotTo(CFrame.new(v:GetAttribute("OriginalPosition") - Vector3.new(0, dist/50, 0)) * v:GetPivot().Rotation)
		end


	end
end)
